What information does mysql.sock store?

what exactly does mysql.sock store?

mysql.sock is generally used to connect to databases locally as a socket for mysql , which is faster than TCP/IP connections. It is usually placed under the / tmp/mysql.sock directory. Let"s first take a look at its contents:

[root@ tmp]-sharp mysql -uroot -p -hlocalhost
ERROR 2002 (HY000): Can"t connect to local MySQL server through socket "/var/lib/mysql/mysql.sock" (2)

the contents of the two are exactly the same except that the inode numbers are different, but you can"t use mysql to access the local database. Why can"t the new socket replace the original socket file? what exactly is stored in this file, and how is it authenticated with the database?

Apr.21,2021

after thinking for a long time, I have my own explanation, but it may not be correct because I did not look at the specific design and implementation code of socket by linux. For more information, please see https://codeshelper.com/a/11.

.

if you want to see the specific implementation, please refer to the linux source code: http://man7.org/linux/man-pag.

.
Menu