I\'m getting this error
ERROR 2002 (HY000): Can\'t connect to local MySQL server through socket \'/var/run/mysqld/mysql.sock\' (2)
even though
There is another chance of you to get this particular error if you modify the max_connections
in my.cnf
file.
I also faced the same error which did not let me log in to MySQL server. In my case the problem was, I had to increase the max_connections
size in
/etc/mysql/my.cnf
to
set-variable = max_connections = 5000
Due to this reason next day when I stared MySQL server it threw this error
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
Removing the set-variable = max_connections = 5000
segment from my.conf
file did the trick. After removing that particular segment following command was used. MySQL server started up and running like previously.
sudo /etc/init.d/mysql start
make sure the bind address configuration option in the my.cnf file in /etc/ is the same with localhost or virtual serve ip address. plus check to make sure that the directory for creating the socket file is well specified.
I was stuck with this error too, and it took almost 3 hours to find it.
First of all, try to recall the changes that you made to your conf file, then undo the changes and save the file and start mysql. If you want to make any changes to the conf file, then stop mysql server and then change the desired values and restart mysql.
This error occurs because of an incorrect (wrong keyword or wrong value assigned) change made to the conf file. Most of the times this error occurs even if you restart the machine running the server, as the server is stopped, in that case, start mysql server.
This provides an alternative solution if the issue relates to you. If your disk drive is full than the MYSQL server (and most other programmes) is unable to start. Delete files and folders to allow Mysql-server to start up.
recently i have faced with this error in my mysql
ERROR 2002 (HY000)
:
Can't connect to local MySQL server through socket
'/var/lib/mysql/mysql.sock' (111)
because i forget to start my mariadb. just type this command on ur terminal.
systemctl start mariadb.service
You don't need to reinstall MySQL server I was facing the same issue but I have resolved the issue by running these commands.
ps -A|grep mysql
sudo pkill mysql
ps -A|grep mysqld
sudo pkill mysqld
sudo service mysql restart
mysql -u root -p