Share this on

MySQL server is not reachable


You are here: InLoox Support Knowledge Base Support Articles InLoox 5.x / 6.x Troubleshooter Database management systems MySQL server is not reachable

Problem:

Clients cannot connect to the MySQL data base.

 

Solution:

Usually, the MySQL data base is only configured for local access. The solution is divided into two parts:

  1. Configure MySQL for external access.
  2. Configure the user logins, so that MySQL accepts external logins.

 
Part 1:

There are two approaches to solve this problem .Both of them can be configured in "my.cnf" in the section [mysqld].

  • In older MySQL versions, the problem is most likely related to the parameter SkipNetworking. If it is activated, MySQL only listens on local sockets. It has to be commentated out:

#SkipNetworking
 

  • Newer versions have the parameter bind-address. It is used to specify an IP where a listener will look for connection or it is possible to deactivate the listener.

For example the following settings are possible:
bind-address 127.0.0.1     # only localhost
bind-address 192.168.0.100 # only locale IPs
                           # (useful within a DMZ)

If the "my.cnf" has been changed, the MySQL demon has to be informed:

/etc/init.d/mysql reload

Please test if the external access is working. Type the following into a DOS box:

"telnet SERVER 3306"

If the connection does not work, the problem is related to another setting (e.g. firewall, router, etc.). If the connection is successful the version number and some characters are displayed.
 
Part 2:

Now, the user logins have to be configured for external access. Users of Confixx or Plesk can simply perform this task in the admin user interface. Manually, it has to be done as follows (in the example for user “max”):
 
#In Shell/Putty:
mysql - uroot - p mysql
#enter root password
#now you are on the MySQL Client, which only understands SQL instructions:
update user set host='%' where user='max';
update db set host='%' where user='max';
exit;

You can also carry this out via phpMyAdmin.

Important: The table "mysql.user" is responsible for the general user rights.
"mysql.db" controls the access to databases.