Mysql在我的覆盆子pi运行raspian失败

问题描述:

我目前在我的覆盆子pi上使用wordpress。就在最近我试图连接到Apache Web服务器,并得到一个有趣的错误。 Error establishing a database connection.所以我做了一些搜索和摆弄我的覆盆子pi,发现mysql服务不再运行。我做了systemctl status mysql.service -l并得到了这个疯狂的长输出,在一个陌生的语言对我说:Mysql在我的覆盆子pi运行raspian失败

Jun 17 22:06:58 Latridell_Server /etc/init.d/mysql[5630]: 0 processes alive and '/usr/bin/mysqladmin --defaults-file=/etc/mysql/debian.cnf ping' resulted in 
Jun 17 22:06:58 Latridell_Server /etc/init.d/mysql[5630]: [61B blob data] 
Jun 17 22:06:58 Latridell_Server /etc/init.d/mysql[5630]: error: 'Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)' 
Jun 17 22:06:58 Latridell_Server /etc/init.d/mysql[5630]: Check that mysqld is running and that the socket: '/var/run/mysqld/mysqld.sock' exists! 
Jun 17 22:06:58 Latridell_Server /etc/init.d/mysql[5630]: 
Jun 17 22:06:58 Latridell_Server mysql[4891]: Starting MySQL database server: mysqld . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . failed! 
Jun 17 22:06:58 Latridell_Server systemd[1]: mysql.service: control process exited, code=exited status=1 
Jun 17 22:06:58 Latridell_Server systemd[1]: Failed to start LSB: Start and stop the mysql database server daemon. 
Jun 17 22:06:58 Latridell_Server systemd[1]: Unit mysql.service entered failed state. 

可有人请让这种东西吗?

感谢您的帮助提前!

-a在MySQL和linux的世界中徘徊noob

+0

那么这可能意味着什么。你将不得不搜索MySQL自己的日志文件来找出错误。我会开始寻找'/ var/log'(它可以有自己的文件,或者是'syslog'或'messages'或其他地方的一部分)。如果您不能,日志可能被禁用或未正确配置。找出为什么MySQL没有启动可能是一个真正的痛苦。 –

请做这个表扬。

sudo service mysql stop
/usr/bin/mysql_install_db --user=mysql

然后 sudo service mysql start

+0

很好的答案,但为什么它解决了这个问题? –

+0

如果您查看错误代码,您可以看到在启动数据库服务器时没有错误。 这与我经历的非常相似,但在我的情况下,这是由于在mysql数据库安装过程中的用户权限。 如果此代码没有修复它,则必须直接将db目录指定为以下代码。 '#/ usr/local/mysql/bin/mysql_install_db --user = mysql --datadir =/dir/what/you/want' –