mysql 主从配置

1,master配置

/etc/my.cnf配置

log-bin=mysql-bin server-id=2 binlog-ignore-db=information_schema binlog-ignore-db=cluster binlog-ignore-db=mysql binlog-do-db=ufind_db

授权

>GRANT FILE ON *.* TO 'root'@'192.168.1.2' IDENTIFIED BY 'mysql password'; >GRANT REPLICATION SLAVE ON *.* TO 'root'@'192.168.1.2' IDENTIFIED BY 'mysql password'; >FLUSH PRIVILEGES

2,slave配置

/etc/my.cnf配置

log-bin=mysql-bin server-id=3 binlog-ignore-db=information_schema binlog-ignore-db=cluster binlog-ignore-db=mysql replicate-do-db=ufind_db replicate-ignore-db=mysql log-slave-updates slave-skip-errors=all slave-net-timeout=60

设置master信息

change master to master_host='192.168.1.1',master_user='root',master_password='123456',master_log_file='mysql-bin.000004', master_log_pos=28125;

你可能感兴趣的:(mysql 主从配置)