-
6月21日
-
linux下mysql数据库同步 一主一丛
服务器密码:root 123456
root密码:123456
访问策略(防火墙关闭,Selinux关闭):
hosts.allow
mysqld:192.168.1.0/255.255.255.0
sshd:192.168.1.0/255.255.255.0
telnet:192.168.1.0/255.255.255.0
hosts.deny
ALL:ALL
主:192.168.1.244
从:192.168.1.254
mysql远程登录授权方法:
GRANT ALL on *.* to 'root'@'192.168.1.244' identified by '123456'; #单个IP
GRANT ALL on *.* to 'root'@'192.168.1.%' identified by '123456'; #IP段
重载授权表:
FLUSH PRIVILEGES;
exit
主配置:
my.cnf
GRANT REPLICATION SLAVE ON *.* TO 'tongbu'@'192.168.1.254' IDENTIFIED BY '123456';
FLUSH PRIVILEGES;
server-id=1
log-bin=mysql-bin
binlog-do-db = dbname (要同步的数据库名)
service mysqld restart
show master status
从:
server-id=2
log-bin=mysql-bin
binlog-do-db = dbname (要同步的数据库名)
service mysqld restart
stop slave
change master to master_host="192.168.1.244",master_user="tongbu",master_password="123456",master_log_file="mysql-bin.000001",master_log_pos=107;
start slave;
show slave status\G
除非注明,文章均为宿迁波仔博客原创,转载请注明本文地址:http://wangboxyk.cn/post/linux-mysql-fuwuqi-databases.html标签:服务器 linux
- 评论:(5)
- 隐藏评论
【评论很精彩,有内幕、有真相!】