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

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

    Two main reasons:

    1) mysql-server isn't installed! You have to install it (mysql-server and not mysql-client) and run it.

    2) It's installed by default and running. So, it's not possible to run it again through Xampp or Lampp. You have to stop it: sudo service mysql stop

    then you can start it through Xampp. It's possible to check if it's running or not with this code: sudo netstat -tap | grep mysql

    If you see a result like this: tcp 0 0 localhost:mysql : LISTEN 1043/mysqld

    It means that it's running properly.

提交回复
热议问题