Menu Close

Cannot connect to MySQL on a remote host

Problem:

  • 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)

Background:

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.

Solution:

  1. Edit the configuration file my.cf and ensure that the following is set:
    bind-address=<external-ip of remote host>
  2. Restart MySQL

Root Cause:

Connectivity to the MySQL database was restricted in the my.cf configuration file with the bind-address directive.

 

NOTE:
(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.

 

VN:F [1.9.22_1171]
Rating: 0 (from 0 votes)
Print Friendly, PDF & Email

Leave a Reply

Your email address will not be published. Required fields are marked *