tags:

views:

690

answers:

3

I use the following command:

mysql -u root -h 127.0.0.1 -p

and the error message is :

ERROR 2003 (HY000): Can't connect to MySQL server on '127.0.0.1' (111)

Who can help me to fix it, thanks in advance.

+1  A: 

You need to change the bind-address parameter to 127.0.0.1 in the mysql config file (my.ini or my.cnf) or use the one that is defined there.

If that doesn't work you should check that the mysql service is actually running.

nkr1pt
I have add the line "bind-address = 127.0.0.1" to the file my.cnf. But it doesn't work.
Charlie Epps
A: 

What do you do if you have several my.cnf files, how do you tell which one is used?

/usr/local/mysql-5.1.50-linux-i686-glibc23/mysql-test/include/default_my.cnf
/usr/local/mysql-5.1.50-linux-i686-glibc23/mysql-test/suite/federated/my.cnf
/usr/local/mysql-5.1.50-linux-i686-glibc23/mysql-test/suite/ndb/my.cnf
/usr/local/mysql-5.1.50-linux-i686-glibc23/mysql-test/suite/rpl/my.cnf
/usr/local/mysql-5.1.50-linux-i686-glibc23/mysql-test/suite/rpl_ndb/my.cnf
Thomas Wessel
A: 

Is the server started with --skip-networking?

Please check http://dev.mysql.com/doc/refman/5.1/en/can-not-connect-to-server.html for a solution.

Serbaut