想在 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.
然后,各种百度,折腾半天没弄出问题在哪儿,求教啊!
1
gaocc OP 求问题出在哪儿,查出来是 1 和 10,但启动就是报重复
有说是其它配置覆盖了,可 win7 系统我也没找见哪个文件会覆盖的 my.ini |
2
msg7086 2018-04-14 08:14:10 +08:00
master_host='127.0.0.1'
你连自己干什么? |
3
msg7086 2018-04-14 08:15:07 +08:00
你要是同一台机器下开两台 mysql,你给第二台换端口了吗?要不然连 127.0.0.1 不是连他自己玩了?
|