首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Mysql问题:没有mysql.sock

Mysql问题:没有mysql.sock
EN

Stack Overflow用户
提问于 2011-04-03 14:36:53
回答 5查看 17.5K关注 0票数 3

昨天,我正在使用安装在我电脑上的MySQL。

我下载了xampp,所以我在my.cnf文件中更改了套接字的路径:

代码语言:javascript
复制
 /opt/lampp/var/mysql/mysql.sock  

那份文件就在那儿。今天我想继续处理它,我发现文件已经不在了,所以我在启动mysql服务器时会收到以下错误:

代码语言:javascript
复制
ERROR 2002 (HY000): 
Can't connect to local MySQL server through socket 
'/opt/lampp/var/mysql/mysql.sock' (2)

以下是我做的一些测试:

代码语言:javascript
复制
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的二进制文件:

代码语言:javascript
复制
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

(对不起,我不知道如何以一种肯定的方式显示终端信息)有人能在这方面帮助我吗?提前感谢!

EN

回答 5

Stack Overflow用户

回答已采纳

发布于 2011-04-03 15:06:17

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

从mysql设置到套接字的

检查路径mysqladmin \ grep d.sock #创建符号链接ln -s path_to_mysql_socket path_to_mysql_socket

票数 6
EN

Stack Overflow用户

发布于 2011-04-03 14:41:30

虽然您所做的测试有点混乱,但我将假设测试只是证明mysql没有运行。

根据mysql自身配置的方式,应该有一个启动文件,通常位于/etc/rc.*目录附近,您需要运行rc.mysql启动(例如,它可能是rc3.d目录中的S<nn>MySQL )。

票数 1
EN

Stack Overflow用户

发布于 2011-04-12 10:54:38

我没有找到解决问题的确切原因。我只是重新安装,然后一切都好起来了。

这不是一个真正的解决方案,但它奏效了。祝好运

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/5530215

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档