ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (111)
While trying to
launch mysql, you get the error shown above, then you can get really frustrated. I got this error one time but for me I guess it was my ignorance. I had
installed everthing except what I needed the most.
Solution to Mysql ERROR 2002 (HY000)
This is how I fixed the problem - "ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (111)":
- Mysql server was not installed
Installed it with : yum install mysql-server.i686 -y - this is in Fedorah . If this is your issue, remember to initialize mysql by setting root password .
You must start the mysqld service to
- Invalid reference to your my.cnf file - see
- If you get this error while working with php, you need to confirm if php.ini (/etc/php.ini) is set to the correct mysql socket file. Check the socket
file settings for mysql in /etc/my.cnf and ensure it matches with php's . Edit accordingly and restart apache.
Setup new password for mysql as follows:
- Start mysqld service for it to create necessary tables and other information - service mysqld start
- On the console type /usr/bin/mysqladmin -u root password 'your-new-password'
- Restart mysql - just in case ;) - service mysqld restart
- Login into mysql from console and run a some grant queries
GRANT some proviledges:
Try to connect to mysql server and things should work. At this point, its good to read more on mysql security :
TYVM you\'ve solved all my prbloems
Post your Comments