一、主庫mysql
設置my.cnfsql
server_id = 2 必須惟一數據庫
binlog-do-db = abo-assist 備份的數據庫ide
log-bin=mysql-bin 開啓binlog日誌
建立同步帳號並受權server
grant replication slave on *.* to 'replication'@'%' identified by '123456';同步
二、從庫io
server_id = 10 必須惟一ast
三、開啓主從同步(從庫上操做)file
mysql> stop slave;
mysql>change master to master_host='192.168.190.131',master_user='replication',master_password='123456',master_port=3336,master_log_file='mysql-bin.000002',master_log_pos=120;
mysql> start slave;
備註
清除從庫日誌
mysql>show slave status\G (查看從庫備份狀態)
mysql>reset master
mysql訪問外部地址
myql -h -u -p