这是我一生中第一次拥有 Ubuntu,所以我不太了解该如何管理以及应该寻找什么;我使用的是 18.04 版本。我安装了 MySQL 5.7,它运行了几天,但突然它甚至无法重新启动,无法再次启动(service mysql start
或任何东西)......
使用systemctl status mysql.service
我得到:
● mysql.service - MySQL Community Server
Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor
preset: enabled)
Active: failed (Result: exit-code) since Thu 2018-07-26 14:24:49 CEST;
10min ago
Process: 3758 ExecStart=/usr/sbin/mysqld --daemonize --pid-
file=/run/mysqld/mysqld.pid (code=exited
Process: 3749 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre
(code=exited, status=0/SUCCESS)
јул 26 14:24:49 maax systemd[1]: mysql.service: Service hold-off
time over, scheduling restart.
јул 26 14:24:49 maax systemd[1]: mysql.service: Scheduled
restart
job, restart counter is at 5.
јул 26 14:24:49 maax systemd[1]: Stopped MySQL Community Server.
јул 26 14:24:49 maax systemd[1]: mysql.service: Start request
repeated too quickly.
јул 26 14:24:49 maax systemd[1]: mysql.service: Failed with
result 'exit-code'.
јул 26 14:24:49 maax systemd[1]: Failed to start MySQL Community
Server.
并使用journalctl -xe
我得到:
јул 26 14:24:49 maax systemd[1]: mysql.service: Scheduled
restart job, restart counter is at 5.
-- Subject: Automatic restarting of a unit has been scheduled
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- Automatic restarting of the unit mysql.service has been scheduled,
as the result for
-- the configured Restart= setting for the unit.
јул 26 14:24:49 maax systemd[1]: Stopped MySQL Community Server.
-- Subject: Unit mysql.service has finished shutting down
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- Unit mysql.service has finished shutting down.
јул 26 14:24:49 maax systemd[1]: mysql.service: Start request
repeated too quickly.
јул 26 14:24:49 maax systemd[1]: mysql.service: Failed with
result 'exit-code'.
јул 26 14:24:49 maax systemd[1]: Failed to start MySQL Community
Server.
-- Subject: Unit mysql.service has failed
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- Unit mysql.service has failed.
--
-- The result is RESULT.
我该怎么做才能修复这个问题并继续正常每天使用 Mysql?
my.cnf 说 error.log 应该在这里:log_error = /var/log/mysql/error.log,但我不再有该文件夹,我不知道为什么,my.cnf 中没有任何变化。现在我再次创建了 mysql 文件夹,但它当然是空的。
当我重新安装 Mysql 时,它运行正常,但是过了一段时间,它又崩溃了......
答案1
看一下这个: https://stackoverflow.com/questions/43440534/mysql-doesn-start-at-all
服务无法正常工作的原因是“mysql.service:启动请求重复太快。”
您能否尝试使用 systemctl:
systemctl stop mysql.service
在那之后:
systemctl start mysql.service