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?
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?
If you are using ubuntu
, you have to use the following steps to avoid this error:
vim /etc/mysql/my.cnf
bind-address = 127.0.0.1
using the # symbolUpdate
In Step 1, if you cannot find bind-address
in the my.cnf
file, look for it in /etc/mysql/mysql.conf.d/mysqld.cnf
file.
Try localhost
instead of 127.0.0.1
to connect or in your connection-config
. Worked for me on a Debian Squeeze Server
In my case (remote connnection) helped turning off firewall on server.
service iptables stop
This happens when you forget to start the database before connecting to it:
mysql.server start
then
mysql -u root -p -h 127.0.0.1
look at the my.cnf
file, if there contain [client]
section, and the port
is other than real listen port (default 3306), you must connect the server with explicit parameter -P 3306
, e.g.
mysql -u root -h 127.0.0.1 -p -P 3306
This problem may occur because your MySQL server is not installed and running. To do that start command prompt as admin and enter command:
"C:\Program Files (x86)\MySQL\MySQL Server 5.1\bin\mysqld" --install
If you get "service successfully installed" message then you need to start the MySQL service. To do that: go to Services window (Task Manager -> Services -> Open Services) Search for MySQL and Start it from the top navigation bar. Then if try to open mysql.exe it will work.
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.
Incase you are running on a non-default port, you may try using --port=
provided --skip-networking
is not enabled.
I just have this problem.... running in Win7 and wamp server ... after reading this
Found that Antivirus Firewall has caused the problem.
I was also facing the same issue. The following helped me fix the problem go to control panel-> Administrative tools-->services inside this you will most certainly see the MySQL servce: right click and say start(force start).
i just restart my mysql server and the problem solved in windows net stop MySQL then net start MySQl ubuntu linux sudo service start mysql
I changed the installation directory on re-install, and it worked.