Mysql问题:没有mysql.sock

发布于 2024-10-29 22:26:23 字数 2892 浏览 1 评论 0原文

昨天我正在使用安装在我的计算机上的 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

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

Yesterday I was working using MySQL installed on my computer.
I downloaded xampp, so I have I changed on my.cnf file the path to the socket:

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

That file was just there. Today I wanted to keep working on it, and I found that file is not there anymore, so I am getting the following error while I am starting mysql server:

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

Here are some tests I made:

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

As a possible solution I uninstalled xampp and reinstall it, and also a new MySQL server, just in case. Anyway, that file is not there anymore.

EDIT
Where the mysql.sock should be, instead there are two files mysql_upgrade_info (Which contains just 5.5.8) and another binary file called 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

(Sorry, I don't know how to show terminal messages in an appropiuate way)
Can anybody help me on this? Thanks in advance!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

揽清风入怀 2024-11-05 22:26:23

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

# 从 mysql 设置检查套接字路径  
mysqladmin | mysqladmin | grep d.sock

# 创建一个符号链接
ln -s path_to_mysql_socket /opt/lampp/var/mysql/mysql.sock

You can locate the actual socket file and create a symbolic link leading to it as follows:

# 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
终止放荡 2024-11-05 22:26:23

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

根据 mysql 如何配置自身,应该在某个地方有一个启动文件,通常在 /etc/rc.* 目录周围,并且您需要运行 rc.mysql start (或者它可能是 S;例如,MySQL 位于 rc3.d 目录中

Although the test you did is a bit garbled, Im going to assume that the test just prove mysql isnt running.

Depending on how the mysql configured itself there should be a startup file somewhere, usually around the /etc/rc.* directories, and you would need to run the rc.mysql start (or it could be a S<nn>MySQL in an rc3.d directory for example

很糊涂小朋友 2024-11-05 22:26:23

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

I didn't find a certain reason for my problem.
I just unisntalled and reinstalled, and then everything went Ok.
That is not a real solution, but it worked. Good luck

萌能量女王 2024-11-05 22:26:23

当我向其他用户授予 *.* 权限时,我遇到了同样的情况。 Mysql 试图授予对 mysql 数据库的权限,这引发了灾难:立即,mysql.sock 文件消失了。

5.6 版本发生了这种情况

I came in the same situation when I made a grant to *.* to other user. Mysql tried to give permissions over the mysql database and that provoked the disaster: instantly, the mysql.sock file disappeared.

this happened with the version 5.6

旧梦荧光笔 2024-11-05 22:26:23

我和你有同样的问题,我发现了一些有用的信息:

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,问题就解决了。

I had the same problem with you, and I found some useful information:

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.

So, I rebooted the computer and restarted XAMPP, and the problem was resolved.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文