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

后端 未结 30 1801
再見小時候
再見小時候 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-11-30 23:53

    I have the same problem and tried all the solutions posted here like :

    sudo apt-get autoremove mysql-server
    

    but unfortunately it doesn't work for me on ubuntu 16.04. To uninstall the right package you need to :

    sudo apt-get remove mysql-
    

    when you tried to autocomplete using tab the command it will list the following package :

    mysql-client           mysql-client-core-5.7  mysql-server           mysql-server-core-5.7  mysql-workbench        mythes-en-us           
    mysql-client-5.7       mysql-common           mysql-server-5.7       mysql-utilities        mysql-workbench-data   
    

    obviously choose the mysql-server-core-5.7 so it would be :

    sudo apt-get remove mysql-server-core-5.7
    

    and now you can uninstall all mysql and reinstall again using these command from johnny's answer :

    sudo apt-get remove --purge mysql*
    sudo apt-get autoremove
    sudo apt-get autoclean
    sudo apt-get install mysql-server mysql-client
    

    Now I solved it and the Error is GONE.

提交回复
热议问题