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 we display long text, we often need to interc...
Table of contents Find the problem 1. How to remo...
The default port number of the Windows server rem...
1.1 Copy the nginx installation package and insta...
In the migration of Oracle database to MySQL data...
Recently, I encountered the need to embed a player...
1. Confirm whether MySQL has been installed. You ...
When using docker, you may find that the file can...
Table of contents Angular accomplish Calling orde...
Use js to control the light switch for your refer...
1. What is a servlet 1.1. Explain in official wor...
Table of contents Overview Object rest attribute ...
This article is a simple calculator written using...
Overview of MySQL Partitioned Tables We often enc...
Use vite to build a vue3 project You can quickly ...