Tag Archives: /var/lib/mysql/mysql.sock

How to Solve can‘t connect to local mysql server through socket ‘/var/lib/mysql/mysql.sock‘

After the MySQL dataDir directory is migrated, the error prompts “can’t connect to local MySQL server through socket ‘/ var/lib/MySQL”/ mysql.sock ‘

solve:

Open my.cnf The changes are as follows:

[client]
port = 3306
socket = /new/mysql/ mysql.sock

[mysqld]

datadir=/new/mysql
socket=/new/mysql/ mysql.sock