Error connecting to MySQL database remotely

1.1k Views Asked by At

I have a MySQL database which I would like to connect to from a remote machine. I have commented out bind-address in /etc/mysql/my.cnf to allow remote connections. Locally on the machine I can now log in to MySQL

mysql --host=[SERVER_IP] --user=[USER] --password=[PASSWORD] [DATABASE]

which works fine. I cannot, however, log in from my laptop. Here I get an error

ERROR 2003 (HY000): Can't connect to MySQL server on [SERVER_IP] (110)

when I run the same command as above. I can ping the server

64 bytes from [SERVER_IP]: icmp_seq=1 ttl=64 time=0.367 ms

without any errors. I can also traceroute

1  * * *

without any errors. Finally, I have run nmap with the following result:

3306/tcp open mysql

which would indicate that this is not a firewall issue.

Does anybody have any idea of whats going on? Any help would be appreciated!

EDIT: I forgot to mention that I have also given the user access rights:

 GRANT ALL ON [DB_NAME].* to '[USER]'@'%' IDENTIFIED BY '[PASSWORD]'

Sorry about that!

1

There are 1 best solutions below

3
Anshu Dwibhashi On

Here are some possibilities:

  • you dont have permissions to use the file from different computers
  • the file is not accessible
  • you can't connect to the host
  • user/pass doesn't have permissions on the other computer
  • if you say you get no response from the server, that is your problem, your server is not responding. aka it isn't online