在MySQL中设置`server-id`变量不起作用 [英] Setting `server-id` variable in MySQL doesn't work

查看:1638
本文介绍了在MySQL中设置`server-id`变量不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直试图将两个数据库设置为master& ;;奴隶.

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

我在这里遵循了著名的指南: https://dev.mysql.com/doc/refman /5.1/zh-CN/replication-howto-existingdata.html

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

但是我的从属服务器上没有运气, 我遇到的问题是设置server-id变量. 不管我在哪里定义它(我研究了所有可能允许我定义变量的cnf文件)

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)

我试图这样定义它:

[mysqld]
server-id = 2

我也尝试使用SET GLOBAL server_id进行设置,但是显然,它没有保存设置.

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

当我这样做:

SHOW VARIABLES LIKE 'server_id'

返回

server_id 0

在我研究过的cnf文件中:

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

我的MySQL服务器在Ubuntu上运行. 如果有关系,请输入以下内容:

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!

附加说明:

MySQL忽略全局conf文件

我几次收到此警告,当我将chmod返回etc/mysql文件夹上的644时,它消失了,尽管上述所有尝试都使用644和777权限进行了尝试,但使用644时,警告消失了.

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.

推荐答案

我知道已经很晚了,但是对于那些会犯错误的人来说. 它是 server_id ,而不是 server-id :

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

这篇关于在MySQL中设置`server-id`变量不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆