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
When the DataSource property of a DataGrid control...
Method 1: To use respin, follow these steps: sudo...
<br />Although there are many web page creat...
In web projects we often use the timeline control...
MySql batch insert optimization Sql execution eff...
<br />What is web2.0? Web2.0 includes those ...
Table of contents 1. MySQL join buffer 2. JoinBuf...
Table of contents Basic instructions and usage An...
This article introduces how to install Chrome bro...
Copy code The code is as follows: <!DOCTYPE HT...
Main differences: 1. Type SQL databases are prima...
Table of contents 1. Function Binding 2. With par...
This article mainly introduces how to implement l...
Introduction to jQuery The jQuery library can be ...
Table of contents Objectives for this period 1. F...