我已经安装了MySQL-server,在防火墙中启用了端口3306,然后执行了sudo systemctl restart mysql
,我收到错误:-
Job for mysql.service failed because the control process exited with error code. See "systemctl status mysql.service" and "journalctl -xe" for details.
在查看了systemctl status mysql.service
之后,我得到了日志:
● mysql.service - MySQL Community Server
Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
Active: activating (auto-restart) (Result: exit-code) since Sun 2021-08-15 20:11:40 PDT; 132ms ago
Process: 2801384 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=0/SUCCESS)
Process: 2801392 ExecStart=/usr/sbin/mysqld (code=exited, status=1/FAILURE)
Main PID: 2801392 (code=exited, status=1/FAILURE)
Status: "Server startup in progress"
Error: 99 (Cannot assign requested address)
然后,我在this stackoverflow answer的帮助下修复了Process: 2801392 ExecStart=/usr/sbin/mysqld (code=exited, status=1/FAILURE)
行的错误。然后我再一次执行
systemctl status mysql.service
我得到了一段时间的日志:
Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
Active: activating (start) since Sun 2021-08-15 20:11:38 PDT; 541ms ago
Process: 2801384 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=0/SUCCESS)
Main PID: 2801392 (mysqld)
Status: "Server startup in progress"
Tasks: 13 (limit: 309219)
Memory: 248.2M
CGroup: /system.slice/mysql.service
└─2801392 /usr/sbin/mysqld
但是几秒钟后,日志再次开始显示前一个(code=exited,status=1/FAILURE)。
还有journalctl -xe
的日志:-
-- Support: http://www.ubuntu.com/support
--
-- An ExecStart= process belonging to unit mysql.service has exited.
--
-- The process' exit code is 'exited' and its exit status is 1.
Aug 15 20:16:13 si-gpu1.linkgrid.com systemd[1]: mysql.service: Failed with result 'exit-code'.
-- Subject: Unit failed
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- The unit mysql.service has entered the 'failed' state with result 'exit-code'.
Aug 15 20:16:13 si-gpu1.linkgrid.com systemd[1]: Failed to start MySQL Community Server.
-- Subject: A start job for unit mysql.service has failed
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- A start job for unit mysql.service has finished with a failure.
--
-- The job identifier is 5422093 and the job result is failed.
Aug 15 20:16:14 si-gpu1.linkgrid.com systemd[1]: mysql.service: Scheduled restart job, restart counter is at 199.
-- 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.
Aug 15 20:16:14 si-gpu1.linkgrid.com systemd[1]: Stopped MySQL Community Server.
-- Subject: A stop job for unit mysql.service has finished
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- A stop job for unit mysql.service has finished.
--
-- The job identifier is 5422193 and the job result is done.
Aug 15 20:16:14 si-gpu1.linkgrid.com systemd[1]: Starting MySQL Community Server...
-- Subject: A start job for unit mysql.service has begun execution
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- A start job for unit mysql.service has begun execution.
在下面的this之后给出了日志:
mysql.service: Scheduled restart job, restart counter is at 628.
-- 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.
Aug 15 20:35:38 si-gpu1.linkgrid.com systemd[1]: Stopped MySQL Community Server.
-- Subject: A stop job for unit mysql.service has finished
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- A stop job for unit mysql.service has finished.
--
-- The job identifier is 5465197 and the job result is done.
Aug 15 20:35:38 si-gpu1.linkgrid.com sshd[2830014]: Invalid user support from 122.53.65.209 port 63290
Aug 15 20:35:38 si-gpu1.linkgrid.com systemd[1]: Starting MySQL Community Server...
-- Subject: A start job for unit mysql.service has begun execution
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- A start job for unit mysql.service has begun execution.
我做了很多事情(包括重新安装),这是在网上提到的。但都不管用。“我只会启动服务器。”
发布于 2021-11-03 10:33:21
尝试以下命令:
/etc/init.d/mysql stop
service mysql stop
killall -KILL mysql mysqld_safe mysqld
/etc/init.d/mysql start
service mysql start
https://stackoverflow.com/questions/68797150
复制相似问题