mysql設置主從複製

在my.cnf確認主和從的server_id不一致mysql

主:sql

show master status;

+------------------+----------+--------------+------------------+-----------------------------------------------+
| File | Position | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set |
+------------------+----------+--------------+------------------+-----------------------------------------------+
| mysql-bin.000048 | 104783 | | | 9a9bcbe6-d459-11e9-82f8-068c8400044e:1-184780 |
+------------------+----------+--------------+------------------+-----------------------------------------------+spa

從:code

stop slave;reset slave;
change master to master_host='192.168.1.20', master_port=3307, master_user='mysql_user', master_password='123456', master_log_file='mysql-bin.000048', master_log_pos=104783;
start slave; 
show slave status\G

注意:server

#須要master_log_file和master_log_pos須要和在主中查詢到的數據一致blog

#  reset slave;執行以後,須要重啓mysql才能真正清空配置信息it

相關文章
相關標籤/搜索