无法通过 socket '/var/mysql/mysql.sock' 连接到本地 MySQL 服务器 (38)
2021-11-20 00:00:00
mysql
我在尝试连接到 mysql 时遇到了大问题.当我跑步时:
I am having a big problem trying to connect to mysql. When I run:
/usr/local/mysql/bin/mysql start
我有以下错误:
Can't connect to local MySQL server through socket '/var/mysql/mysql.sock' (38)
我在 /var/mysql
目录下有 mysql.sock
.
在 /etc/my.cnf
我有:
[client]
port=3306
socket=/var/mysql/mysql.sock
[mysqld]
port=3306
socket=/var/mysql/mysql.sock
key_buffer_size=16M
max_allowed_packet=8M
在 /etc/php.ini
我有:
; Default socket name for local MySQL connects. If empty, uses the built-in
; MySQL defaults.
mysql.default_socket = /var/mysql/mysql.sock
我已经使用 sudo/opt/local/apache2/bin/apachectl restart
但我仍然有错误.
否则,我不知道这是否相关,但是当我执行 mysql_config --sockets
我得到
Otherwise, I don't know if that's relevant but when I do mysql_config --sockets
I get
--socket [/tmp/mysql.sock]
推荐答案
确保你正在运行 mysqld : /etc/init.d/mysql start
Make sure you are running mysqld : /etc/init.d/mysql start
相关文章