码迷,mamicode.com
首页 > 数据库 > 详细

mysql设置主从复制

时间:2019-09-16 22:00:26      阅读:175      评论:0      收藏:0      [点我收藏+]

标签:uri   ignore   art   mysql-bin   mysql   user   res   sla   strong   

在my.cnf确认主和从的server_id不一致

主:

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 |
+------------------+----------+--------------+------------------+-----------------------------------------------+

从:

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

注意:需要master_log_file和master_log_pos需要和在主中查询到的数据一致

 

mysql设置主从复制

标签:uri   ignore   art   mysql-bin   mysql   user   res   sla   strong   

原文地址:https://www.cnblogs.com/Nora-F/p/11529898.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!