0

EDIT
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 = 127.0.0.1
master-user = masterUser
master-password = masterpassword
master-port = 3336 (I am using port forwarding, so that why I use 127.0.0.1 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

and

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

[mysqld]
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

to

character-set-server utf8

Thanks in advance

0

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.
1
  • 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 – Skaros Ilias Apr 7 '18 at 19:59
0

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

CHANGE MASTER TO MASTER_HOST="127.0.0.1", MASTER_USER='user', MASTER_PASSWORD='password', MASTER_LOG_FLIE='mysql-bin.000080', MASTER_LOG_POS=107, MASTER_PORT=7777;

Your Answer

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

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