error message: ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) Cause of the problem: It is possible that the [mysqld] parameter socket is set in the my.cnf configuration file, but the [client] parameter socket is not set. What is the mysql.sock file used for: mysql supports both socket and TCP/IP connections. So what is the use of the mysql.sock file? Connections to localhost are usually made through a Unix domain socket file, typically /tmp/mysql.sock. If the socket file is deleted, local clients will not be able to connect. The /tmp folder is a temporary file and may be deleted at any time. 1. TCP connection (if an error message is displayed for /tmp/mysql.sock, you can try this method to connect)
2.Socket connection
Solution: Add the [client] configuration item as shown below Before configuration: (Before configuring [client], an error message will be reported: '/tmp/mysql.sock' (2))
After configuration: (After configuring [client], restart the mysql service)
end, this article ends, I hope it will be helpful to everyone! You may also be interested in:
|
<<: Tutorial on deploying multiple servers with WebApi and configuring Nginx load balancing
>>: Vue uses WebSocket to simulate the chat function
Recently, a database in the production environmen...
After reading some articles, I finally figured ou...
This article example shares the specific code of ...
Table of contents Error message Cause Error demon...
1. Find out whether MySQL was installed before Co...
Table of contents Portals Error Boundary Handling...
The final solution is in the last picture If you ...
Table of contents 1. Scenario 2. Simplify the und...
In the process of web front-end development, UI d...
1. Create a table CREATE TABLE `student` ( `id` i...
Maybe you are using include files here, which is u...
01. Command Overview The locate command is actual...
1. First enter the server's mysql to modify p...
Solve the problem of Chinese garbled characters i...
The detailed process of installing python3.7.0 on...