- Cannot connect to a MySQL database on a remote host (port 3306)
- Firewalls aren’t blocking traffic and network connectivity is available.
- The MySQL database is up and running on the remote host and can be accessed when connecting from to it on the remote host (as localhost)
Access to a MySQL database may be restricted and this restriction may be configured in the configuration file my.cf A directive such as bind-address=127.0.0.1 will ensure that the MySQL database can be accessed only from localhost.
- Edit the configuration file my.cf and ensure that the following is set:
bind-address=<external-ip of remote host>
- Restart MySQL
Connectivity to the MySQL database was restricted in the my.cf configuration file with the bind-address directive.
(1) The solution above describes a successful problem-solving experience and may not be applicable to other problems with similar symptoms.
(2) Your rating of this post will be much appreciated. Also, feel free to leave comments.