如何实现两台服务器mysql数据库同步
若以下回答无法解决问题,邀请你更新回答
1个回答
2016-07-22
展开全部
1.主上修改my.cnf文件:
server-id=1
log-bin=mysql-bin
2.从上修改配置文件 my.cnf
server-id=2
relay-log=relay-bin
read-only =1
replicate-ignore-db = mysql
replicate-ignore-db = test
replicate-ignore-db = information_schema
#replicate-wild-do-table = tt.admin
replicate-wild-do-table = my_db.stu // 所要同步的数据库的单个表
3. 创建 同步的用户(主上)
grant replication client,replication slave on *.* to rep@'10.41.50.105' identified by 'root';
4.同步到主库(在从上操作)
change master to master_host='10.41.50.80',master_user='rep',master_password='root';
5.在从上验证:
show slave status\G;
主从同步某些表
server-id=1
log-bin=mysql-bin
2.从上修改配置文件 my.cnf
server-id=2
relay-log=relay-bin
read-only =1
replicate-ignore-db = mysql
replicate-ignore-db = test
replicate-ignore-db = information_schema
#replicate-wild-do-table = tt.admin
replicate-wild-do-table = my_db.stu // 所要同步的数据库的单个表
3. 创建 同步的用户(主上)
grant replication client,replication slave on *.* to rep@'10.41.50.105' identified by 'root';
4.同步到主库(在从上操作)
change master to master_host='10.41.50.80',master_user='rep',master_password='root';
5.在从上验证:
show slave status\G;
主从同步某些表
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询
广告 您可能关注的内容 |