Mysql – Can’t connect to remote MySQL server

MySQL

When I tried to connect the remote MySQL server by using command line mysql -h <remote-ip> -u any_existing_users -p or any other mysql client such as phpmyadmin, it didn't work and the error hint was

ERROR 2003 (HY000) Can't connect to MySQL server on '<remote-ip>' (61)

But, when I tried ssh <remote-ip> and connected the MySQL locally by mysql -u root -p, there is no problem.

Here is part of the user table(SELECT User, Host FROM mysql.user;):

+------------------+----------------+
| User             | Host           |
+------------------+----------------+
| root             | %              |
| other_users      | <remote-ip>    |
| root             | localhost      |
+------------------+----------------+

So, what's the problem?

Best Answer

Have you enable networking in your mysql server, please verify once more if not below are the steps by which you can do it

  Edit /etc/my.cnf, run:
  # vi /etc/my.cnf

  Once file opened, locate line that read as follows

  [mysqld] 
  Make sure line skip-networking is commented (or remove line) and add following line

  bind-address=YOUR-SERVER-IP