[mysqld]
user = mysql
port = 63306
socket = /data/mysql-m-5.6.32/mysql.sock
basedir = /data/mysql-m-5.6.32
datadir = /data/mysql-m-5.6.32/data
log-error = /data/mysql-m-5.6.32/mysql_error.log
pid-file = /data/mysql-m-5.6.32/mysql.pid
log-bin = mysql-bin #开启bin日志,并设置名称
server-id = 1 #设置serviced,不可重复
expire_logs_days = 2 #设置日志过期时间
[mysqld]
user = mysql
port = 63307
socket = /data/mysql-s-5.6.32/mysql.sock
basedir = /data/mysql-s-5.6.32
datadir = /data/mysql-s-5.6.32/data
log-error = /data/mysql-s-5.6.32/mysql_error.log
pid-file = /data/mysql-s-5.6.32/mysql.pid
server-id = 2 #服务唯一id
mysql -uroot -P63306 -S /data/mysql-m-5.6.32/mysql.sock
GRANT REPLICATION SLAVE ON *.* to 'mysync'@'%' identified by 'mocentre';
GRANT REPLICATION SLAVE ON *.* to 'mysync'@'localhost' identified by 'mocentre';
*请注意,有些版本区分 % 和 localhost
show master status;
mysql -uroot -P63307 -S /data/mysql-s-5.6.32/mysql.sock
change master to master_host='127.0.0.1',master_user='mysync',master_password='mocentre',master_log_file='mysql-bin.000001',master_log_pos=330
请注意账户密码,master_log_file 这里的master_log容易遇到错误,请调试注意。
show slave status\G
start slave;
stop slave;
show slave status\G
mysqlbinlog --start-position=230 /data/mysql/binlog/mysql-bin.000001
http://369369.blog.51cto.com/319630/790921/ http://www.cnblogs.com/good_hans/archive/2010/03/29/1700046.html http://www.linuxidc.com/Linux/2012-02/54729.htm