Mysql – MariaDB – Replication – Unable to login remotely

mariadbmariadb-10.5master-slave-replicationMySQL

So I've been trying to configure MariaDB replication for our server. Unfortunately I cannot get it replicating correctly.

So I've followed the MariaDB guide to the letter to get replication set up. Master and slave are configured and the slave is set connect to the master. The slave shows the error as:

Lost connection to server at 'waiting for initial communication packet', system error:110 "connection timed out".

I've noticed that I am unable to login to the master from the slave with -u root -p -h xxx.xxx.xxx.xxx. Though the servers are able to ping one another and all ports are allowed between the two, I can ssh between them and transfer files. Both replication and root users have the required permissions to login remotely and locally.

So I trawled google and implemented some changes to try and further diagnose the issue, such as bind address changes and max packet size. But no luck. I also noticed I am unable to login to the master from the master if I specify its IP address rather than just localhost. I get the error:

ERROR 1045 (28000):access denied for user 'root'@'xxx.xxx.xxx.xxx' (using password: YES).

Any ideas will be much appreciated!

Master is running the following:
Ubuntu server 16:04, MariaDB 10.0.38

Slave is running:
Ubuntu server 20.04, MariaDB 10.5.4

Best Answer

I think this is a good clue to what is wrong:

I also noticed I am unable to login to the master from the master if I specify its IP address rather than just localhost.

It seems as if you don't have the right host specified for the user you have created. In MariaDB and MySQL when you create a user you also need to specify a "host". This can e.g. be a specific IP address to allow connections from that IP address only, or it can be a wildcard to allow connections from all hosts, or a partial IP address combined with a wildcard:

CREATE USER replication_user@'%' IDENTIFIED BY 'super_secret_password';