且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

无法通过套接字'/tmp/mysql.sock'连接到本地MySQL服务器

更新时间:2023-02-04 21:43:49

这个问题有些过时,但是我在研究类似问题时遇到了它.使用mysql_config命令确认套接字的位置和名称有助于解决我的问题.

This question is somewhat dated, but it I came across it while researching a similar issue. Confirming the socket location and name with the mysql_config command was instrumental in resolving my problem.

我遇到了同样的错误,并且已经调整了config/database.yml中的套接字入口路径以匹配找到.sock文件的位置.

I was getting the same error and had adjusted the socket entry path in config/database.yml to match where I found the .sock file.

但是,除了路径更改之外,我的database.yml文件中的套接字条目也称为"mysql.sock",与我在搜索过程中与该问题有关的大多数讨论一样.

However beyond the path change, the socket entry in my database.yml file referred to "mysql.sock", as do most of the discussions related to this issue during my search.

mysql_config的输出略有不同.它显示文件名是"mysqld.sock" ...注意'd',而不是mysql.sock.我错过了它,因为我专注于这条路.

The output of mysql_config was slightly different. It revealed that the file name was "mysqld.sock"...notice the 'd', not mysql.sock. I missed it because I was focussing on the path.

mysql安装仅在服务器上的VPS,没有客户端上,这可能解释了套接字文件名的差异.

The mysql installation is on a server only VPS, no client, which may explain the difference in the socket file name.