It seems that the problem is with my SSH connection, so I created a different question on serverfault. From what I understand so far, it that this problem is caused from the fact that the port forwarding is not established properly.

Original question
I am trying to create a master-slave sync between two Mysql instances. After a lot of work, I at least have two running servers (since I had so many problems that most of the times I was breaking something). Now, on my slave my.cnf file I have

server-id = 155
log_bin = /var/log/mysql/mysql-bin.log
master-host =
master-user = masterUser
master-password = masterpassword
master-port = 3336 (I am using port forwarding, so that why I use as host)

The problem is that when I ask for the slave's id I get 0

mysqld --help --verbose |grep server-id

replicate-same-server-id FALSE
server-id 0


mysql> SHOW VARIABLES LIKE 'server_id';

| Variable_name | Value |
| server_id | 0 |

The file I am using is the proper file, since when I added this

collation-server = utf8_unicode_ci
init-connect='SET NAMES utf8'
character-set-server = utf8

the result of mysqld --help --verbose |grep character-set-server changed from

character-set-server latin1


character-set-server utf8

Thanks in advance

2 Answers 2


A few things to check:

  • Have you restarted the MySQL instance after setting the server-id variable in my.cnf? (Obvious, I know, but I have to ask!)
  • In which section of the my.cnf file have you added this variable? The [mysqld] section would be an appropriate place for it, I think.
  • Do you have any other .cnf files that might overwrite your setting? Assuming Linux, a command such as mysqld --help --verbose | head -n 20 should give you some output which includes the files where mysqld is looking for default settings.
  • Sorry for the delay. I am out of the office due to local holiday, so don't have the all t answers but I can tell you that I do restart msql, as I stated on my question I do have the [mysqld] section over my options and that I used some command, that I don't remember now, to find all configuration files. All we empty except the one I am editing. Also prior to this problem while I was editing these settings mysqld failed to start, so settings where read by mysql Apr 7, 2018 at 19:59

As it turned out one of my problems was that I was reading the wrong documentation. The guide I was following was for an older version of mysql. for the current version the settings for the master are not entered inside the configuration file but using a mysql command


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.