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