【问题标题】:Mysql has failed in my raspberry pi running raspianMysql 在运行 raspbian 的树莓派中失败
【发布时间】:2017-11-20 11:04:47
【问题描述】:

我目前在我的树莓派上使用 wordpress。就在最近,我尝试连接到 apache Web 服务器并遇到了一个有趣的错误。 Error establishing a database connection. 所以我四处寻找和摆弄我的树莓派,发现 mysql 服务不再运行。我做了一个systemctl status mysql.service -l,得到了这个疯狂的长输出,对我来说是一种外星语言:

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.

有人可以做点什么吗?

提前感谢您的帮助!

-一个在 mysql 和 linux 的世界里游荡的菜鸟

【问题讨论】:

  • 嗯,这可能意味着什么。您将不得不搜索 MySQL 自己的日志文件以找出问题所在。我会开始查看/var/log(它可能有自己的文件或者是syslogmessages 或其他地方的一部分)。如果不能,则日志记录可能已禁用或未正确配置。找出 MySQL 没有启动的原因可能会很痛苦。

标签: mysql linux shell lamp


【解决方案1】:

请做这个表扬。

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

那么 sudo service mysql start

【讨论】:

  • 查看错误码可以看到启动db server没有错误。这与我所经历的非常相似,但在我的情况下,这是由于 mysql-database 安装过程中的用户权限。如果此代码没有修复它,您必须直接指定 db 目录,如下面的代码。 #/usr/local/mysql/bin/mysql_install_db --user=mysql -–datadir=/dir/what/you/want
猜你喜欢
  • 1970-01-01
  • 2020-02-20
  • 1970-01-01
  • 2015-04-08
  • 2017-07-21
  • 1970-01-01
  • 2023-03-10
  • 1970-01-01
  • 2019-05-17
相关资源
最近更新 更多