MySQL 2个数据库之间的共享

注:需保持2个数据库之间可以通讯

MySQL 2个数据库之间的共享_第1张图片

Master端:在my.ini文件中 加入

log-bin = 
server-id = 1
binlog-do-db = 同步数据库名称

 
Slave端: 在my.ini文件中加入

server-id = 2
master-host = 192.168.16.53
master-user = root
master-password = mysql
master-port = 3306
master-connect-retry = 60
replicate-do-db = 同步数据库名称
#replicate-wild-do-table = 同步数据库.同步表

注:修改 salve端 配置的时候,需要把mysql的data 目录下的master.info 删除后重新启动服务才能生效

MySQL 2个数据库之间的共享_第2张图片

Master端:my.ini中加入


log-bin = 
server-id = 1
binlog-do-db = 16.9数据库
master-host = 192.168.16.53
master-user = root
master-password = mysql
master-port = 3306
master-connect-retry = 60
replicate-do-db = 16.53数据库

 
Slave配置:


log-bin = 
server-id = 2
binlog-do-db = 16.53数据库
master-host = 192.168.16.9
master-user = root
master-password = 888
master-port = 3306
master-connect-retry = 60
replicate-do-db = 15.9数据库

很久以前弄得了,估计现在早过时了....

你可能感兴趣的:(数据库,mysql,数据备份)