Mysql问题:没有mysql.sock

时间:2011-04-03 14:36:53

标签: mysql xampp ubuntu-10.10

昨天我正在使用安装在我电脑上的MySQL 我下载了xampp,所以我在my.cnf文件中更改了套接字的路径:

 /opt/lampp/var/mysql/mysql.sock  

那个档案就在那里。今天我想继续努力,我发现该文件不再存在,所以当我启动mysql服务器时出现以下错误:

ERROR 2002 (HY000): 
Can't connect to local MySQL server through socket 
'/opt/lampp/var/mysql/mysql.sock' (2)

以下是我做的一些测试:

mujeresponja@ubuntu:~$ ps -fea | grep mysqld
1000     15707 15615  0 16:28 pts/1    00:00:00 grep --color=auto mysqld
mujeresponja@ubuntu:~$ ps -fea | grep mysql 
1000     15709 15615  0 16:29 pts/1    00:00:00 grep --color=auto mysql

作为一种可能的解决方案,我卸载了xampp并重新安装它,以及一个新的MySQL服务器,以防万一。无论如何,那个文件不再存在了。

修改 mysql.sock应该在哪里,而是有两个文件mysql_upgrade_info(其中只包含5.5.8)和另一个名为ubuntu.err的二进制文件:

mujeresponja@ubuntu:/opt/lampp/var/mysql$ sudo cat ubuntu.err 
110403 17:28:52 mysqld_safe Starting mysqld daemon with databases from /opt/lampp/var/mysql
110403 17:28:52 [Note] Plugin 'FEDERATED' is disabled.
/opt/lampp/sbin/mysqld: Can't find file: './mysql/plugin.frm' (errno: 13)
110403 17:28:52 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
InnoDB: The InnoDB memory heap is disabled
InnoDB: Mutexes and rw_locks use InnoDB's own implementation
InnoDB: Compressed tables use zlib 1.2.3
110403 17:28:52  InnoDB: Initializing buffer pool, size = 16.0M
110403 17:28:52  InnoDB: Completed initialization of buffer pool
110403 17:28:52  InnoDB: Operating system error number 13 in a file operation.
InnoDB: The error means mysqld does not have the access rights to
InnoDB: the directory.
InnoDB: File name /opt/lampp/var/mysql/ibdata1
InnoDB: File operation call: 'create'.
InnoDB: Cannot continue operation.
110403 17:28:52 mysqld_safe mysqld from pid file /opt/lampp/var/mysql/ubuntu.pid ended
110403 17:29:22 mysqld_safe Starting mysqld daemon with databases from /opt/lampp/var/mysql
110403 17:29:22 [Note] Plugin 'FEDERATED' is disabled.
/opt/lampp/sbin/mysqld: Can't find file: './mysql/plugin.frm' (errno: 13)
110403 17:29:22 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
InnoDB: The InnoDB memory heap is disabled
InnoDB: Mutexes and rw_locks use InnoDB's own implementation
InnoDB: Compressed tables use zlib 1.2.3
110403 17:29:22  InnoDB: Initializing buffer pool, size = 16.0M
110403 17:29:22  InnoDB: Completed initialization of buffer pool
110403 17:29:22  InnoDB: Operating system error number 13 in a file operation.
InnoDB: The error means mysqld does not have the access rights to
InnoDB: the directory.
InnoDB: File name /opt/lampp/var/mysql/ibdata1
InnoDB: File operation call: 'create'.
InnoDB: Cannot continue operation.
110403 17:29:22 mysqld_safe mysqld from pid file /opt/lampp/var/mysql/ubuntu.pid ended

(抱歉,我不知道如何以适当的方式显示终端消息)  有人可以帮我这个吗?提前谢谢!

5 个答案:

答案 0 :(得分:6)

您可以找到实际的套接字文件并创建一个指向它的符号链接,如下所示:

# check path to socket from mysql settings  
mysqladmin | grep d.sock

# create a symbolic link
ln -s path_to_mysql_socket /opt/lampp/var/mysql/mysql.sock

答案 1 :(得分:1)

虽然你做的测试有点乱,我会假设测试只是证明mysql没有运行。

根据mysql配置本身的方式,应该有一个启动文件,通常在/etc/rc.*目录周围,你需要运行rc.mysql start(或者它可能是{{1}在例如

的rc3.d目录中

答案 2 :(得分:1)

我没有找到解决问题的原因。 我只是unisntalled并重新安装,然后一切都很好。
这不是一个真正的解决方案,但它确实有效。祝你好运

答案 3 :(得分:0)

当我向其他用户授予*。*时,我遇到了同样的情况。 Mysql尝试通过mysql数据库授予权限并引发了灾难:瞬间,mysql.sock文件消失了。

这发生在版本5.6

答案 4 :(得分:0)

我遇到了同样的问题,我找到了一些有用的信息:

2015-08-14 10:51:17 30934 [ERROR] InnoDB: Unable to lock /opt/lampp/var/mysql/ibdata1, error: 11
2015-08-14 10:51:17 30934 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.

因此,我重新启动了计算机并重新启动了XAMPP,问题得以解决。