Thursday, April 11, 2013

Resolving mysql error 111


MySql Error 111 means connection refused, which may be coming because of several reasons. Some of which are: 

1.  Your MySQL server is configured that it listes to only connections from localhost. So check if you are getting this error only from some other machine or even from localhost where your DB Server is installed. 

If its only from other machines, check your my.cnf file for below items, comment them and restart tomcat. 


skip-networking
bind-address = 127.0.0.1


2.  If you could login as root to mysql then you should add user privileges. Try command below: 


GRANT ALL PRIVILEGES ON * . * TO  'username'@'IP_ADDRESS' IDENTIFIED BY  '*44612AC693E3B8F7AEA36B50168860122FE106A8'
flush privileges;

The string "*44612AC693E3B8F7AEA36B50168860122FE106A8" is actually the hash password as generated by mysql. Use below command to generate these hashes: 


mysql> select password('test123!');
+-------------------------------------------+
| password('test123!')                      |
+-------------------------------------------+
| *44612AC693E3B8F7AEA36B50168860122FE106A8 | 
+-------------------------------------------+
1 row in set (0.02 sec)


3.  Check firewalls to make sure that they are not blocking the connection. 

No comments:

Post a Comment