MySQL operation and maintenance 20-socket file

1. Definition of socket file

A socket file is a Linux socket file (also known as a socket file) that the server uses to communicate with local clients.

2. The location of the socket file

  • The default location is /tmp/mysql.sock.
  • This file being in the /tmp directory can cause some problems, anyone on some versions of Linux can delete the file in the /tmp directory, which will prevent MySQL from being able to log in through the socket file. Under the Linux system, the system itself will automatically delete some files in the /tmp directory, but will not delete the socket file.
  • Therefore, the socket file is best placed in the directory of a separate MySQL instance itself. For example, do the following configuration in /etc/my.cnf:
[mysqld]
socket=/path/to/socket
[client]
socket=/path/to/socket

Guess you like

Origin blog.csdn.net/oddrock/article/details/130173712