ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysql.sock' (2)

后端 未结 30 1839
再見小時候
再見小時候 2020-11-30 23:15

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

30条回答
  •  孤城傲影
    2020-12-01 00:02

    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
    

提交回复
热议问题