1、二进制日志
主:
#master vim /etc/mysql/my.cnf #server-id server-id=2 #二进制日志 log-bin=musql-bin #statement row mixed binlog-format=mixed
从:
#slave vim /etc/mysql/my.cnf #server-id server-id=2 relay-log-mysql-relay
2、授权
#master mysql -uroot mysql>glant replication client,replication slave on *.* to 'repl'@ip identified by 'repl'
#slave mysq -uroot #master中使用show master status查看Position,File mysql>change master to master_host='master IP',master_user='repl',master_password='repl',master_log_file='mysql-bin.00000x',master_log_pos=xxx
mysql>show slave status G #查看
mysql>start slave;