赞
踩
今天在翻看之前所记得笔记的时候,发现当初,学习mysql主从数据库搭建的笔记,发出来,留个纪念。
搭建环境 虚拟机linux centOS6.3 mysql + 本地win8 mysql数据库(尽量保持版本相同,不要差别太大,最好一致)
Window 上面的数据库充当主服务器
第一步:建立主服务器
打开my.Ini(linux中为mycnf)。
找到如下一段鸟文
# Replication Master Server (default)
# binary logging is required for replication
log-bin=mysql-bin #开启二进制日志
# binary logging format – mixed recommended
binlog_format=mixed #指定日志格式
# required unique id between 1 and 2^32 – 1
# defaults to 1 if master-host is not set
# but will not function as a master if omitted
server-id = 1 #给服务器起一个唯一的id 大小在1-2^32 -1之间
=======重启mysql======
【授权给从服务器】给从服务器开通一个读取主服务器的帐号
GRANT REPLICATION SLAVE,REPLICATION CLIENT ON *.* TO slave@’192.168.0.%’ IDENTIFIED BY ‘111111’;
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。