想在 win7 系统也试试读写分离,然后就一个笔记本电脑,我的做法是复制出第二个 mysql,加到服务里,修改 my.ini 如下:
主:
server-id = 1
binlog-do-db=community_ms
log-bin=mysql-bin
从:
server-id = 10
replicate-do-db= community_ms
log-bin=mysql-bin
然后配了用户:
create user 'forslave'@'127.0.0.1' identified by '123456';
GRANT REPLICATION SLAVE ON . TO 'forslave'@'127.0.0.1';
添加用户:
change master to master_host='127.0.0.1',
master_port=3306,
master_user='forslave',
master_password='123456',
master_log_file='mysql-bin.xxx',
master_log_pos=xxx;
启动
slave start;
然后查看:
show slave status;
结果 slave_io_running 一直是 NO
查日志报错如下:
[ERROR] The slave I/O thread stops because master and slave have equal MySQL server ids; these ids must be different for replication to work (or the --replicate-same-server-id option must be used on slave but this does not always make sense; please check the manual before using it).
就是说 id 重复了,可配置文件里明明不一样,然后用:
show variables like 'server_id';
看了下也是一个 1,一个 10.
然后,各种百度,折腾半天没弄出问题在哪儿,求教啊!