When I am trying to connect to a MySQL database from a remote computer I get a prompt saying: Connection Failed: [HY000] [MySQL][ODBC 5.1 Driver]Can’t Connect to MySQL server on ‘XXX.XXX.XX.XX’ (10060)
I have created a user account in the MySQL Administrator and added a host to enable remote access, I have also made an exception for my Windows Firewall on port 3306 but the connection still fails.
What is the problem?
Check the mysql configuration: /etc/my.cnf
and comment out:
Now it will be listening to TCP/IP ports, however you have usually blocked direct access to MySQL via the firewall anyway, so it shouldn’t be a problem. You can now SSH in over TCP/IP as ” localhost ” to the MySQL server.
e.g. Windows bat file, PuTTY tunnel:
If you have XAMPP/MySQL running on your local machine, change the above port to 3307. ie:
But that’s not a good idea. If you are going to access the database from another remote server, why don’t you place a file inside your site with some security such htpasswd protection or some authentication module.
If you are going to get data of a mysql server to another server, be precise with the requirement.
If it’s just for data synchronization, go for db server concepts.
answered Apr 30 ’10 at 13:04
The error 10060 means that you are not allowed to access the web server remotely. Therefore
- Make sure that you are using the correct IP-address of the MySQL server.
- The rest of the parameters of your connection are the same.
- Use the % wildcard for the host part of the user account to allow connect from any host (see Adding User Accounts article).
answered May 29 at 9:28
The likely culprit that people often forget is:
This step is needed to be able to connect from the computer 123.456.789.123 More information and a more complete guide can be found at Holicreature’s link.
answered Apr 30 ’10 at 13:07
Permission gives a different error code. jweyrich Apr 30 ’10 at 13:08
I had exactly the same issue communicating between a MSSQL Server database on one (Win2008) server and a MySQL database on another.
I had already created an ODBC connection between one MSSQL Server and the MySQL server a couple of years ago; primarily to allow me to create a Linked Server object on the MSSQL Server.
When trying to create an ODBC connection from a different server I receive the same error:
After following some of the suggestions in the answers found here, I decided to check the firewall rules on the (Win2008) server hosting MySQL.
I had an inbound rule set up that locked port 3306 down to be accessible only from a list of IP addresses. Once I added my latest server’s IP to the list, I was able to connect.
Posted In: NEWS