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

后端 未结 30 1813
再見小時候
再見小時候 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:01

    This is an old tread with different solution proposed, but none of them worked for me. I'm adding this answer in the hope it will help somebody who struggled as me for some time.

    I've checked all the existing answers and all the existing solution, but for me the issue was incorrect user permission on var/run/mysql folder.

    I've checked the user permission on that folder and it was set to root. Once i changed to mysql:mysql the problem has gone.

    So enter into /var/run/mysqld and change the user permission to:

    chown -R mysql:mysql .
    

提交回复
热议问题