Setting `server-id` variable in MySQL doesn't work

无人久伴 提交于 2019-12-07 08:47:25

问题


I've been trying to set up two databases as master & slave.

I followed the famous guide here: https://dev.mysql.com/doc/refman/5.1/en/replication-howto-existingdata.html

But no luck on my slave server, The issue I'm having is setting the server-id variable. No matter where I define it (I looked into all the possible cnf files that might allow me to define the variable)

I tried to define it like so:

[mysqld]
server-id = 2

I also tried setting it by using SET GLOBAL server_id but obviously, it didn't save the setting.

when I do:

SHOW VARIABLES LIKE 'server_id'

It returns

server_id 0

Among the cnf files I've looked into are:

etc/mysql/mysql.conf.d/mysqld.cnf
etc/mysql/mysql.conf.d/mysqld_safe_syslog.cnf
etc/mysql/conf.d/mysql.cnf
etc/mysql/debian.cnf
etc/mysql/mysql.cnf
usr/my.cnf
usr/my-new.cnf
usr/etc/my.cnf

My MySQL server is running on Ubuntu. And if it matters, I start it by typing:

service mysql start

I'd love to know where else I could look to fix this issue. Thanks a bunch!

Additional Notes:

MySQL Ignoring the global conf file

I received this warning a couple of times and it disappeared when I returned the chmod to 644 on the etc/mysql folder, although every thing stated above was attempted using both 644 and 777 permissions, with 644 the warning disappears.


回答1:


I know it's to late, but for those who will make the mistake. It's server_id and not server-id:

[mysqld]
server_id = 2


来源:https://stackoverflow.com/questions/33328652/setting-server-id-variable-in-mysql-doesnt-work

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!