Tag Archives: Ubuntu ERROR 2003

Ubuntu ERROR 2003 (HY000): Can’t connect to MySQL server on ‘127.0.0.1’ (111)

Configure a remote connection to mysql

MySQL>GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'yourpassword' WITH GRANT OPTION;

MySQL>FLUSH PRIVILEGES;

When you connect to mysql remotely

mysql -h127.0.0.1 -u root  -p

Error:
ERROR 2003 (HY000): Can’t connect to MySQL Server on ‘127.0.0.1’ (111)
Solutions:

sudo vi /etc/mysql/my.cnf

Delete the following line.
#bind-address           = 127.0.0.1

sudo /etc/init.d/mysql restart