The role of mysql.sock

Mysql has two connection methods:

(1), TCP/IP

(2), socket

For mysql.sock, its function is that the program and mysqlserver are on the same machine, and it is available when a local connection is initiated.

For example, you do not need to define the specific IP address to connect to the host, as long as it is empty or localhost.

In this case, even if you change the external port of mysql, it is still possible to connect normally.

Because you change the port in my.ini or my.cnf, mysql.sock is generated with each mysql server startup. It has been regenerated when you restarted mysql after changing my.cnf, and the information has been changed accordingly.

Then for external connections, you must change the port to connect.

When installing mysql connection under linux, it often prompts that the mysql.sock file cannot be found. The solution is very simple:

if it is a newly installed mysql, it prompts that the file cannot be found, just search and specify the correct location.

If the mysql.sock file is deleted by mistake, you need to restart the mysql service. If the restart is successful, mysql.sock will be generated in the datadir directory and can be specified at that time.

http://www.2cto.com/database/201510/446700.html

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326287493&siteId=291194637