MySQL 无法连接到系统总线:无法连接到套接字 /var/run/dbus/system_bus_socket

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/15372828/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-31 16:53:16  来源:igfitidea点击:

unable to connect to system bus: failed to connect to socket /var/run/dbus/system_bus_socket

mysqlubuntuvps

提问by mt0s

I started to use a new VPS system with ubuntu 12.04

我开始在ubuntu 12.04上使用新的VPS系统

After following the commands hereI installed php, mysql, apache2

按照这里的命令之后我安装了 php、mysql、apache2

PHP and apache are working great but when I run :

PHP 和 apache 运行良好,但是当我运行时:

service mysql start 

I get : unable to connect to system bus: failed to connect to socket /var/run/dbus/system_bus_socket: No such file or directory.

我得到: unable to connect to system bus: failed to connect to socket /var/run/dbus/system_bus_socket: No such file or directory.

I googled but didn't find enough to help me.

我用谷歌搜索但没有找到足够的帮助我。

There is no /var/run/dbus/ directory and I don't know what I need to create one or even if this is the problem for mysql.

没有 /var/run/dbus/ 目录,我不知道我需要创建什么目录,或者即使这是 mysql 的问题。

回答by JW.

I had this error message and discovered that it was a sign that initctl(the 'init daemon control tool') was being called (indirectly) without the necessary privileges.

我收到此错误消息并发现它表明initctl(“初始化守护进程控制工具”)在没有必要权限的情况下被(间接)调用。

In other words:

换句话说:

It failed because:

它失败了,因为:

  • I was not logged in as the rootuser,
  • nor was I prefixing my 'daemon control' command with sudo.
  • 我没有以root用户身份登录,
  • 我也没有在我的“守护进程控制”命令前加上sudo.

Either one would have solved the issue.

任何一个都可以解决这个问题。

It's a bit confusing because you would have thought a 'privilage issue' would trigger an error message that talks about 'privilage thangs'. But, no. It talks about being "unable to connect to system bus".

这有点令人困惑,因为您会认为“特权问题”会触发一条关于“特权胜过”的错误消息。但不是。它谈到“无法连接到系统总线”。

So, may I suggest:

所以,我可以建议:

Try temporarily elevating your privileges by prefixing your command with sudo.

尝试通过在命令前加上前缀来临时提升您的权限sudo

Assuming that the hash symbol (#) indicates your command prompt, run the following command instead:

假设井号 ( #) 表示您的命令提示符,请改为运行以下命令:

# sudo service mysql start 

Then, type in your user password as prompted.

然后,根据提示输入您的用户密码。

OR

或者

If you have set a password for the rootuser on your installation of Ubuntu, you could elevate to that Super User by typing:

如果您root在安装 Ubuntu 时为用户设置了密码,则可以通过键入以下内容提升为该超级用户:

# su

Then, type in the rootpassword as prompted.

然后root根据提示输入密码。

Then, in this context, your original command should, now, work:

然后,在这种情况下,您的原始命令现在应该可以工作:

# service mysql start 


See it's man page DESCRIPTIONfor more information about initctl's connection to service start, stop, restart, reloadand statuscommands.

看到它的人的页面描述有关详细信息initctl的服务连接startstoprestartreloadstatus命令。