Mysql奇怪的连接问题

时间:2009-11-17 23:21:23

标签: mysql mysql-error-2002 mysql-error-2006

我有一个奇怪的问题。我在我的ubuntu 9.04上安装了mysql 5.1。

我已经用了很长时间(比如说3个月),一切都很顺利。直到我遇到这个非常奇怪的问题。

当我想连接到随机数据库时,我收到此消息:

ERROR 2006 (HY000): MySQL server has gone away
No connection. Trying to reconnect...
Connection id:    1
Current database: test_cake

ERROR 2006 (HY000): MySQL server has gone away
No connection. Trying to reconnect...
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (111)
ERROR: 
Can't connect to the server

它只发生在某些数据库中,而其他数据库则非常有用且健康。之后,如果我尝试重新启动服务器,我会得到这个。

shell> /etc/init.d/mysql restart
 * Stopping MySQL database server mysqld                                        cat: /var/run/mysqld/mysqld.pid: Permiso denegado
                                                                         [fail]
 * Starting MySQL database server mysqld                                        cat: /var/run/mysqld/mysqld.pid: Permiso denegado
cat: /var/run/mysqld/mysqld.pid: Permiso denegado
cat: /var/run/mysqld/mysqld.pid: Permiso denegado
cat: /var/run/mysqld/mysqld.pid: Permiso denegado
cat: /var/run/mysqld/mysqld.pid: Permiso denegado
cat: /var/run/mysqld/mysqld.pid: Permiso denegado
cat: /var/run/mysqld/mysqld.pid: Permiso denegado
cat: /var/run/mysqld/mysqld.pid: Permiso denegado
cat: /var/run/mysqld/mysqld.pid: Permiso denegado
cat: /var/run/mysqld/mysqld.pid: Permiso denegado
cat: /var/run/mysqld/mysqld.pid: Permiso denegado
cat: /var/run/mysqld/mysqld.pid: Permiso denegado
cat: /var/run/mysqld/mysqld.pid: Permiso denegado
cat: /var/run/mysqld/mysqld.pid: Permiso denegado
cat: /var/run/mysqld/mysqld.pid: Permiso denegado
cat: /var/run/mysqld/mysqld.pid: Permiso denegado
                                                                         [fail]
("permiso denegado" is "permission denied").

我不知道该怎么办。我更改了/var/run/mysqld/mysqld.pid属性但仍无法正常工作。

有人能帮助我吗?

1 个答案:

答案 0 :(得分:0)

看看这是否有效:

su                   (become root)
su mysql             (become user mysql, or whatever account mysql runs as)
cd /var/run/mysqld   (see if the directory is accessible to mysql)
cat mysqld.pid       (see if the file is accessible)