Managing "mysql.sock" file in Docker database for Cloud Storage synchronization

59 Views Asked by At

I have set up a database using Docker, but I'm encountering issues with a persistent file called mysql.sock. This file is located in a Cloud Storage Service and remains constantly "open", preventing me from synchronizing not only the folder containing it but also any other folder within the sync folder.

I need assistance in managing the mysql.sock file effectively:

  • How can I stop the mysql.sock file from running?

  • Considering that this is my first database and I'm concerned about potential project damage, what precautions should I take before stopping the mysql.sock file?

Any guidance on resolving this 'mysql.sock' issue would be greatly appreciated!

1

There are 1 best solutions below

1
On

"mysql.sock" is a special type of file used for communication with the mysql server. The relevant documentation is here

https://dev.mysql.com/doc/refman/8.0/en/connecting.html

On Unix, MySQL programs treat the host name localhost specially, in 
a way that is likely different from what you expect compared to other 
network-based programs: the client connects using a Unix socket file. 
The --socket option or the MYSQL_UNIX_PORT environment variable may be 
used to specify the socket name.

and

To ensure that the client makes a TCP/IP connection to the local server, 
use --host or -h to specify a host name value of 127.0.0.1 (instead of 
localhost), or the IP address or name of the local server. You can also 
specify the transport protocol explicitly, even for localhost, by using 
the --protocol=TCP option.

You want to prevent the mysql.sock file from ever being created because there's no way to reliably sync it. Here is another answer discussing it.

https://serverfault.com/questions/337818/how-to-force-mysql-to-connect-by-tcp-instead-of-a-unix-socket