connect to local MySQL server through socket

前端 未结 6 1964
不知归路
不知归路 2020-12-05 21:01

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

I tried everything I found o

6条回答
  •  被撕碎了的回忆
    2020-12-05 21:36

    It looks like either it can't create a file in /var/lib/mysql/. If you look at the errode 13, it is generally means permission errors.

    1) Make sure that mySQL can write to the directory /var/lib/mysql and/or that mySQL owns that directory. Do a:

    cd /var/lib ; ls -la | grep mysql
    

    To be sure.

    2) If you are trying to start with the mySQL user, start it with root instead (You probably are, but it's worth checking).

    3) If you are running something like SElinux, make sure that you enable it for mySQL access. I doubt that is the case, but it's worth checking.

    4) Small note: Don't create the sock file - mysql will create one once it is up and running properly. If it still in the run directory, delete it.

提交回复
热议问题