zoukankan      html  css  js  c++  java
  • Mysql 数据库日志与数据文件分开

    参考:
    https://blog.csdn.net/jiao_fuyou/article/details/78366621

    myql默认配置情况下,二进制日志文件是保存在默认的数据目录 data 下,如:/usr/local/mysql/data。
    有时我们希望把 binlog 修改保存到其他目录下,现记录下操作过程。
    假设原目录为: /usr/local/mysql/data,并且已有一些日志文件 mysql-bin.??????
    新目录为: /var/log/mysql/

    1. 停止数据库
    systemctl stop mysqld.service

    2. 修改日志存放路径:

    vi /etc/my.cnf
    修改 log-bin=mysql-bin 为 log-bin=/var/log/mysql/mysql-bin

    mkdir -p /var/log/mysql/
    chown -R mysql /var/log/mysql/
    chgrp -R mysql /var/log/mysql/

    cp /var/lib/mysql/mysql-bin.* /var/log/mysql/

    3. 修改新路径

    vi /var/log/mysql/mysql-bin.index
    把每一行的文件路径改为新目录的绝对路径
    即 ./mysql-bin.?????? 改为/var/log/mysql/mysql-bin.??????


    /var/log/mysql/mysql-bin.000001
    /var/log/mysql/mysql-bin.000002
    /var/log/mysql/mysql-bin.000003
    /var/log/mysql/mysql-bin.000004
    /var/log/mysql/mysql-bin.000005
    /var/log/mysql/mysql-bin.000006
    /var/log/mysql/mysql-bin.000007
    /var/log/mysql/mysql-bin.000008
    /var/log/mysql/mysql-bin.000009
    /var/log/mysql/mysql-bin.000010
    /var/log/mysql/mysql-bin.000011
    /var/log/mysql/mysql-bin.000012

    4.启动数据库
    mysql.server start

  • 相关阅读:
    基本命令
    Unicode Locale
    二进制查看编辑
    java reg
    java util
    js util
    跑到X
    [转]Linux AIO :libaio
    [转]c++ atomic操作
    [转] dpdk笔记
  • 原文地址:https://www.cnblogs.com/xiaoer/p/9895063.html
Copyright © 2011-2022 走看看