zoukankan      html  css  js  c++  java
  • mysql 8.0 改变数据目录和日志目录(一)

    一、背景
    
    原数据库数据目录:/data/mysql3306/data,日志文件目录:/data/mysql3306/binlog
    
    变更后数据库目录:/mysqldata/3306/data,日志文件目录:/mysqldata/3306/binlog
    
     
    
    二、操作过程
    
    1、停止原库
    
    [root@node01 ~]# /etc/init.d/mysqld stop
    Shutting down MySQL.. SUCCESS!
    
    2、拷贝数据目录
    
    [root@node01 ~]# cp -a /data/mysql3306/data/* /mysqldata/3306/data/
    
    3、修改参数文件
    
    原参数文件:
    
    [client]
    port=3306
    socket=/tmp/mysql.sock
    
    [mysqld]
    port=3306
    user=mysql
    server_id=1
    socket=/tmp/mysql.sock
    basedir=/usr/local/mysql
    datadir=/data/mysql3306/data
    log-error=/data/mysql3306/data/error.log
    log_bin=/data/mysql3306/binlog/mysql-bin
    gtid_mode=ON
    enforce_gtid_consistency=ON
    log_slave_updates=1
    
     
    
    修改后参数文件:
    
    [client]
    port=3306
    socket=/tmp/mysql.sock
    
    [mysqld]
    port=3306
    user=mysql
    server_id=1
    socket=/tmp/mysql.sock
    basedir=/usr/local/mysql
    datadir=/mysqldata/3306/data
    log-error=/mysqldata/3306/data/error.log
    log_bin=/mysqldata/3306/binlog/mysql-bin
    gtid_mode=ON
    enforce_gtid_consistency=ON
    log_slave_updates=1
    
     
    
    4、启动数据库
    
    [root@node01 ~]# /etc/init.d/mysqld start
    Starting MySQL... SUCCESS!
    
     
    
    三、登录数据库验证
    mysql> show variables like 'datadir';
    +---------------+-----------------------+
    | Variable_name | Value                 |
    +---------------+-----------------------+
    | datadir       | /mysqldata/3306/data/ |
    +---------------+-----------------------+
    1 row in set (0.00 sec)
    
    mysql> show variables like '%log_bin%';
    +---------------------------------+----------------------------------------+
    | Variable_name                   | Value                                  |
    +---------------------------------+----------------------------------------+
    | log_bin                         | ON                                     |
    | log_bin_basename                | /mysqldata/3306/binlog/mysql-bin       |
    | log_bin_index                   | /mysqldata/3306/binlog/mysql-bin.index |
    | log_bin_trust_function_creators | OFF                                    |
    | log_bin_use_v1_row_events       | OFF                                    |
    | sql_log_bin                     | ON                                     |
    +---------------------------------+----------------------------------------+
    6 rows in set (0.01 sec)
    
     
      
    

      

  • 相关阅读:
    php魔术常量,_CLASS_,_METHOD_,_FUNCTION_
    php里parent,::和self的分别
    rewrite例子集合
    PHP中::、->;、self、$this操作符的区别
    php中const和define的区别
    aliyun二级域名绑定
    数组操作函数8
    http 301 和 302的区别
    lnmp引发的fpm502错误!
    关于php下开发的跨域问题总结(全)
  • 原文地址:https://www.cnblogs.com/orcl-2018/p/13734243.html
Copyright © 2011-2022 走看看