mysql单个表的主从同步
时间:2019-11-28 19:12 来源:未知 作者:IT
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;
(责任编辑:IT)
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; (责任编辑:IT) |