Unable to connect to MySQL remotely.
We have two AWS lightsail instances (Ubuntu 14.04.5) and are trying to connect from one to the other.
Both versions of MySQL are 5.6.35.
The last thing I want to do is replication, and the replication slave MySQL log is
Slave I/O: error connecting to master '[email protected]:3306' -
retry-time:60 retries:37, Error_code:2003
appears, but before that, simply
mysql-h xxx.xxx.xxx.xxx-uhoge
However, you cannot connect with the following error:
ERROR 2003 (HY000): Can't connect to MySQL server on 'xxx.xxx.xxx.xxx'
(110)
Telnet also
telnet xxx.xxx.xxx.xxx 3306
is
telnet:Unable to connect to remote host:Connection timed out
I can't connect to it, so I think it's around the port, but I don't know the cause or countermeasure.
Here's what I've done.
Verify MySQL user hoge connection authorization settings
(The hoge was created with grant replication slave on*.* to hoge@'%' identified by 'password';
)
mysql>select user, host from mysql.user;
+-------------+------------------+
| user | host |
+-------------+------------------+
| US>repl|%|
| root | 127.0.0.1 |
| root|::1|
| root | ip-xxx-xxx-xxx-xxx-xx |
| rails_admin | localhost |
| root | localhost |
+-------------+------------------+
My.cnf bind-access comment out
#bind-address=127.0.0.1
Verify Firewall
$sudo iptables-L
Chain INPUT (policy ACCEPT)
target protopt source destination
Chain Forward (policy ACCEPT)
target protopt source destination
Chain OUTPUT (policy ACCEPT)
target protopt source destination
$ sudo ip6 tables-nv-L
Chain INPUT (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target protopt in out source destination
Chain Forward (policy ACCEPT0 packets, 0 bytes)
pkts bytes target protopt in out source destination
Chain OUTPUT (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target protopt in out source destination
Verifying Ports
$sudonetstat-tlpn
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp00 0.0.0.0:800.0.0.0:*LISTEN29604/
tcp00 127.0.0.1:210.0.0.0:*LISTEN595/vsftpd
tcp00 0.0.0.0:22 0.0.0.0:*LISTEN901/sshd
tcp00 0.0.0.0:443 0.0.0.0:*LISTEN29604/
tcp600:::3306:::*LISTEN29139/mysqld.bin
tcp600:::22:::*LISTEN901/sshd
Thank you for your cooperation.
mysql ubuntu network unix
If the server is not LISTENing the port, the client error should be Connection refused
. I think Connection timed out
is a problem around the network (firewalls, routing, etc.).
Whether or not the server is pinged from the slave.
If the ping goes through, can you connect to a port other than 3306 (such as number 22)?
You might want to check the firewall on the client side as well.
593 Uncaught (inpromise) Error on Electron: An object could not be cloned
567 Understanding How to Configure Google API Key
865 When building Fast API+Uvicorn environment with PyInstaller, console=False results in an error
592 GDB gets version error when attempting to debug with the Presense SDK (IDE)
© 2024 OneMinuteCode. All rights reserved.