标签:word 备份 ror sql show error err var log
yum install -y mysql mysql-devel mysql-server mydql-libs
//先备份
cp /etc/my.cnf /etc/my.cnf.bak
vim /etc/my.cnf
[mysqld]
datadir=/data/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
symbolic-links=0
log-bin=mysql-bin
server-id=1
auto_increment_offset=1
auto_increment_increment=2
[mysql_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
replicate-do-db=all
mkdir -p /data/mysql
chown -R mysql:mysql /data/mysql
/etc/init.d/mysqld restart
与master的文件一致,只需修改:
server-id=2
auto_increment_offset=2
[mysql_safe]
master-host=192.168.33.10
master-user=zhangsan
master-pass=123456
master-port=3306
master-connect-retry=60
修改完成后,同样需要执行3、4步骤
grant replication slave on *.* to 'zhangsan'@'%' identified by '123456';
show master status
mysql> change master to master_host='192.168.33.10',master_user='zhangsan',master_password='123456',master_log_file='mysql-bin.0000006',master_log_pos=98;
说明:master_log_file,master_log_pos 这两个参数的值,可以通过show master status查看。
mysql> slave start
mysql> show slave status\G
说明:如果以下两个值为yes,表明连接正常,等待同步。
slave_IO_Running:Yes
Slave_SQL_Running:Yes
标签:word 备份 ror sql show error err var log
原文地址:https://www.cnblogs.com/tomtellyou/p/12538916.html