In mysql, the 2022 error refers to the fact that the socket is not specified during compilation, so the default value is still used when the mysql command is connected. Because the socket location has changed and the mysql command does not know it, it appears. For such errors, you can modify the "/etc/my.cnf" file to resolve the error.
The operating environment of this tutorial: windows10 system, mysql8.0.22 version, Dell G3 computer.
First reproduce the problem phenomenon, the error message is as follows:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
[mysqld] socket=/data/mysql5.7.24/db_test/mysql.sock [client] socket=/data/mysql5.7.24/db_test/mysql.sock
mysql -uroot -p
mysql -uroot -p --socket=/data/mysql5.7.24/db_test/mysql.sock
mysql -uroot -p -S /data/mysql5.7.24/db_test/mysql.sock
The above is the detailed content of What is the 2002 error of mysql?. For more information, please follow other related articles on the PHP Chinese website!