如何实现同一台mysql服务器中不同数据库之间的数据同步
1个回答
展开全部
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;
主从同步某些表
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询