Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)

前端 未结 30 1689
南方客
南方客 2020-11-22 11:30

I am getting the following error when I try to connect to mysql:

Can\'t connect to local MySQL server through socket \'/var/lib/mysql/mysql.sock\' (2)<

30条回答
  •  暖寄归人
    2020-11-22 11:47

    Please ensure you have installed MySQL server correctly, I met this error many times and I think it's complicated to debug from the socket, I mean it might be easier to reinstall it.

    If you are using CentOS 7, here is the correct way to install it:

    First of all, add the mysql community source
    yum install http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm

    Then you can install it by yum install mysql-community-server

    Start it with systemctl: systemctl start mysqld

提交回复
热议问题