Use mysql and mysqldump commands to report that it cannot be connected according to mysqld.sock

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

 Java services, logstash call mysql are all fine. But using mysql, mysqldump command will report the above error.

Solution: add socket=/var/lib/mysql/mysql.sock under the mysql configuration file client, the path is the same as under mysqld

 

Reason: mysql and mysqldump are clients, and the socket configured in mysqld on the server must also be configured in the client

Guess you like

Origin blog.csdn.net/u012452555/article/details/107628640