0

I have been working with master-slave replication in MySQl and was wondering if there is any possibility to set the listen-address property of the MYSQL config file to read the IP statically assigned to host (and may be grabbed using nbtstat -n | find "IpAddress:" and saved as a system variable). The reason is that I do not want any IP changes to affect replication. In that case, I will entirely rely on the reboot that the involved team does after the changes.

1 Answer 1

0

You must create the replication user with the host IP on the Master

CREATE USER 'static_repl'@'10.20.30.253' ... ;
GRANT REPLICATION USER,REPLICATION CLIENT ON *.* to 'static_repl'@'10.20.30.253';

If you have an IP range in mind, use that range

CREATE USER 'static_repl'@'10.20.%' ... ;
GRANT REPLICATION USER,REPLICATION CLIENT ON *.* to 'static_repl'@'10.20.%';

Then, stop the slave, delete the user that is not static from the master, and start the slave.

1
  • I was worried of the listen-address on masters config file. Anyway to handle this dynamically? apart from the 0.0.0.0 setting. Commented Mar 13, 2023 at 20:25

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.