我在 centos5 服务器上使用 MySQL 时遇到了问题。当我尝试连接到服务器时,我收到以下消息
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
我注意到当我运行时,service mysqld stop
它会返回停止 ok 消息。然而当我随后运行时,service mysqld status
它会返回
mysqld (pid 20600) is running...
然后我又运行了几次状态命令,发现 PID 不断增加
mysqld (pid 21835) is running...
[root@s15333475 log]# service mysqld status
mysqld (pid 21927) is running...
[root@s15333475 log]# service mysqld status
mysqld (pid 21988) is running...
[root@s15333475 log]# service mysqld status
mysqld (pid 21988) is running...
[root@s15333475 log]# service mysqld status
mysqld (pid 22079) is running...
[root@s15333475 log]# service mysqld status
mysqld (pid 22079) is running...
尽管我已停止服务,但此问题仍会出现
以下是 ps 的输出
root 582 1 4 16:41 ? 00:06:57 /bin/sh /usr/bin/mysqld_safe --datadir=/var/lib/mysql --socket=/var/lib/mysql/mysql.sock --pid-file=/var/run/mysqld/mysqld.pid --basedir=/usr --user=mysql mysql 6481 582 0 19:17 ? 00:00:00 /usr/libexec/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib64/mysql/plugin --user=mysql --log-error=/var/log/mysqld.log --pid-file=/var/run/mysqld/mysqld.pid --socket=/var/lib/mysql/mysql.sock
希望有人可以帮忙!
干杯