Mysql – error connecting to master ‘replica@192.168.57.10:3306’ mac-ubuntu

mac os xMySQLreplicationUbuntuvmware

Server info:

Master server (Vmware): Ubuntu 18.04    IP: 192.168.57.10
Slave server1 (Vmware): Ubuntu 18.04    IP: 192.168.57.11
Slave server2 (mac): macOS High Sierra  IP: 192.168.0.3

MySQL Server version:

Mac: 5.7.23-log MySQL Community Server (GPL)
Ubuntu: 5.7.23-0ubuntu0.18.04.1-log (Ubuntu)

Server status:

1) Ping between all these three servers works
Result: works
2) ssh loging between all these three servers works Result: works
3) netcat -vv 192.168.0.3 3306 # connecting from 192.168.57.10 and 192.168.57.11 Result: Connection to 192.168.0.3 3306 port [tcp/mysql] succeeded!
4) mysql -p -h 192.168.0.3 # connecting from 192.168.57.10 and 192.168.57.11 Result: works
5) Info: using mysql_native_password
6) Master server: bind-address = 192.168.57.10 Slave server1: bind-address = 192.168.57.11 Slave server2: bind-address = 192.168.0.3 (tried with * also)
7) Master to slave server 1 mysql> show slave status\G Slave_IO_State: Waiting for master to send event Master_Host: 192.168.57.10 Master_User: replica Master_Port: 3306 Connect_Retry: 60 Master_Log_File: mysql-bin.000072 Read_Master_Log_Pos: 154 Relay_Log_File: xxx-serverb-relay-bin.000088 Relay_Log_Pos: 4 Relay_Master_Log_File: mysql-bin.000072 Slave_IO_Running: Connecting Slave_SQL_Running: Yes .... Master_SSL_Allowed: No Master_SSL_CA_File: Master_SSL_CA_Path: Master_SSL_Cert: Master_SSL_Cipher: Master_SSL_Key: Seconds_Behind_Master: 0 Master_SSL_Verify_Server_Cert: No Last_IO_Errno: 0 Last_IO_Error: Last_SQL_Errno: 0 Last_SQL_Error:
Result: works Info: Master-Ubuntu <-> Slave-Ubuntu
8) Master to slave server 2 mysql> show slave status\G Slave_IO_State: Connecting to master Master_Host: 192.168.57.10 Master_User: replica Master_Port: 3306 Connect_Retry: 60 Master_Log_File: mysql-bin.000068 Read_Master_Log_Pos: 154 Relay_Log_File: xxx-iMac-relay-bin.000003 Relay_Log_Pos: 4 Relay_Master_Log_File: mysql-bin.000068 Slave_IO_Running: Connecting Slave_SQL_Running: Yes .... Master_SSL_Allowed: No Master_SSL_CA_File: Master_SSL_CA_Path: Master_SSL_Cert: Master_SSL_Cipher: Master_SSL_Key: Seconds_Behind_Master: NULL Master_SSL_Verify_Server_Cert: No Last_IO_Errno: 1045 Last_IO_Error: error connecting to master 'replica@192.168.57.10:3306' - retry-time: 60 retries: 28 Last_SQL_Errno: 0 Last_SQL_Error:
Result: Not working Info: Master-Ubuntu <-> Slave-Mac

MySQL user details:

mysql> SHOW grants for replica@'%';
+-------------------------------------------------+
| Grants for replica@%                            |
+-------------------------------------------------+
| GRANT REPLICATION SLAVE ON *.* TO 'replica'@'%' |
+-------------------------------------------------+
1 row in set (0.00 sec)

mysql> SHOW grants for replica@'192.168.0.3';
+-----------------------------------------------------------+
| Grants for replica@192.168.0.3                            |
+-----------------------------------------------------------+
| GRANT REPLICATION SLAVE ON *.* TO 'replica'@'192.168.0.3' |
+-----------------------------------------------------------+
1 row in set (0.00 sec)

mysql> SHOW grants for replica@'192.168.57.11';
+-------------------------------------------------------------+
| Grants for replica@192.168.57.11                            |
+-------------------------------------------------------------+
| GRANT REPLICATION SLAVE ON *.* TO 'replica'@'192.168.57.11' |
+-------------------------------------------------------------+
1 row in set (0.00 sec)

Best Answer

Code 1045 is an access denied error.

I advise verify if you have granted privileges to the master user in the mac OSX mysql service.