无法连接到'/var/run/mysqld/mysqld.sock' [英] Can't connect to '/var/run/mysqld/mysqld.sock'

查看:965
本文介绍了无法连接到'/var/run/mysqld/mysqld.sock'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我在这里的第一篇文章,所以我希望我做的一切正确,并且不要忘记任何重要信息.我很高兴得到任何提示,因为我已经没有足够的想法了(如果有的话;)).

This is my first post here, so I hope I do everything right and don't forget any important info. I'm glad for any hints, because I'm running out of ideas (if I ever had any ;)).

我正在(或曾经)在Raspbian Jessie上运行owncloud(所以我想基本上是Debian).突然,owncloud停止了工作. nginx错误指向php5-fpm,进一步的搜索给出了此错误:

I am (or was) running owncloud on Raspbian Jessie (so I guess basically Debian). Suddenly owncloud stopped working. The nginx error points towards php5-fpm, further searches gave this error:

exception 'Doctrine\DBAL\DBALException' with message 'Failed to connect to the database: An exception occured in driver: SQLSTATE[HY000] [2002] Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)' in /var/www/owncloud/lib/private/db/connection.php:54

所以它看起来像一个mysql错误,而/var/run/mysqld/实际上是空的.

So it looks like a mysql error, and /var/run/mysqld/ is actually empty.

这些帖子之后 1 2 ,我尝试过

Following these posts 1 and 2, I tried

sudo find / -type s

结果如下:

/run/php5-fpm.sock
/run/fail2ban/fail2ban.sock
/run/thd.socket
/run/dhcpcd.unpriv.sock
/run/dhcpcd.sock
/run/dbus/system_bus_socket
/run/avahi-daemon/socket
/run/udev/control
/run/systemd/journal/syslog
/run/systemd/journal/socket
/run/systemd/journal/stdout
/run/systemd/journal/dev-log
/run/systemd/shutdownd
/run/systemd/private
/run/systemd/notify
find: `/proc/30933/task/30933/fd/5': No such file or directory
find: `/proc/30933/task/30933/fdinfo/5': No such file or directory
find: `/proc/30933/fd/5': No such file or directory
find: `/proc/30933/fdinfo/5': No such file or directory

另一方面,在带有top的进程中,显示​​mysqld和mysqld_safe. mysql-client,mysql-server和php5-mysql已安装并更新为最新版本.

In the processes with top on the other hand, mysqld and mysqld_safe show up. mysql-client, mysql-server and php5-mysql are installed and updated to the latest versions.

我也看过

/etc/mysql/my.cnf
/etc/mysql/debian.cnf

同时将/var/run/mysqld/mysqld.sock显示为套接字...

both show /var/run/mysqld/mysqld.sock as socket...

/var/lib/mysql/my.cnf

此处不存在.

此外,看来我无法通过

mysql -u user -p

至少它也会导致错误2002.

at least it results in the Error 2002 as well.

最后,我尝试停止并启动mysql服务.结果是

Finally, I tried stopping and starting the mysql service. This resulted in the following output of

systemctl status mysql.service

mysql.service - LSB: Start and stop the mysql database server daemon
Loaded: loaded (/etc/init.d/mysql)
Active: failed (Result: exit-code) since So 2016-04-10 11:54:23 CEST; 23s ago
Process: 9777 ExecStop=/etc/init.d/mysql stop (code=exited, status=0/SUCCESS)
Process: 12878 ExecStart=/etc/init.d/mysql start (code=exited, status=1/FAILURE)

所以我有点迷失了所发生的事情,因为几天前进行了一些更新,所以出现了问题.为了安全起见,在撰写本文时,我再次执行了所有步骤.在某一时刻,我对浏览器中的我自己的cloud实例有一个简短的了解,但是后来又消失了.因此,我感谢您的帮助/提示!

So I'm kind of lost what is going on, the problem occurs since some updates a few days ago. While writing this post, I went through all the steps again, just to be safe. At one point, I had a short glimpse at my owncloud instance in the browser, but then it was gone again. So I appreciate any help/hints!!!

非常感谢您!

推荐答案

我遇到了一个问题:无法连接到'/var/run/mysqld/mysqld.sock'.问题是安装后没有启动mysql服务.一旦运行以下命令,它便可以正常工作:

I faced the issue: Can't connect to '/var/run/mysqld/mysqld.sock'. The problem was that mysql service was not started after installation. Once I run the following command, then it worked properly:

systemctl start mysql.service
mysql -u root -p

这篇关于无法连接到'/var/run/mysqld/mysqld.sock'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆