0

I had mysql master-slave replication working with mysql Ver 14.14 Distrib 5.7.27 -- totally awesome until it broke. Now, I'm not sure why but I cannot get it to work again. /etc/mysql/my.cnf has:

bind-address=0.0.0.0
server_id=2
log_bin=/var/log/mysql/mysql-bin.log
service mysql start
mysql -u root
mysql: [ERROR] unknown variable 'log_bin=/var/log/mysql/mysql-bin.log'

so I take out the log_bin line

service mysql stop
service mysql start
mysql -u root
mysql: [ERROR] unknown variable 'server_id=2'

so I take out the server_id line, and I'm able to get into mysql:

service mysql stop
service mysql start
mysql -u root
mysql> show variables like 'server_id';
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| server_id     | 0     |
+---------------+-------+
1 row in set (0.00 sec)

(I have also tried server-id=2, same result)

If I execute

mysql> SET GLOBAL server_id=2;
Query OK, 0 rows affected (0.00 sec)

mysql> show variables like 'server_id';
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| server_id     | 2     |
+---------------+-------+
1 row in set (0.01 sec)

So I grab the log file and pos from master and try to get slave connected to master:

mysql> CHANGE MASTER TO MASTER_HOST='{master ip}', MASTER_USER='{replication user}', MASTER_PASSWORD='{replication user password}', MASTER_LOG_FILE='mysql-bin.000043', MASTER_LOG_POS=42996;
ERROR 1794 (HY000): Slave is not configured or failed to initialize properly. You must at least set --server-id to enable either a master or a slave. Additional error messages can be found in the MySQL error log.

Any ideas why it is not taking the values from my.cnf/how to get slave re-connected/starting up with a server id other than 0?

  • May be check my.cnf for tabs and other funny characters. – mustaccio Aug 2 at 1:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.