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

前端 未结 30 1601
南方客
南方客 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:44

    If you are on a recent RHEL, you may need to start mariadb (an open source mysql db) instead of the mysql db:

    yum remove mysql
    yum -y install mariadb-server mariadb
    service mariadb start
    

    You should then be able to access mysql in the usual fashion:

    mysql -u root -p
    

提交回复
热议问题