在Docker数据库中管理“mysql.sock”文件以实现云存储同步

kninwzqo  于 2023-08-03  发布在  Docker
关注(0)|答案(1)|浏览(104)

我已经使用Docker建立了一个数据库,但是我遇到了一个名为mysql.sock的持久化文件的问题。此文件位于云存储服务中,并始终保持“打开”状态,不仅阻止我同步包含它的文件夹,还阻止我同步同步文件夹中的任何其他文件夹。
我需要帮助来有效地管理mysql.sock文件:

  • 如何停止运行mysql.sock文件?
  • 考虑到这是我的第一个数据库,我担心可能会对项目造成损害,在停止mysql.sock文件之前,我应该采取哪些预防措施?

任何关于解决这个'mysql.sock'问题的指导都将不胜感激!

kgsdhlau

kgsdhlau1#

“mysql.sock”是一种特殊类型的文件,用于与mysql服务器通信。相关文档在这里
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.

字符串
和/或

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.


您希望防止创建mysql.sock文件,因为没有可靠的同步方法。下面是另一个讨论它的答案。
https://serverfault.com/questions/337818/how-to-force-mysql-to-connect-by-tcp-instead-of-a-unix-socket

相关问题