解决ubuntu安装mysql后关机慢

问题

ubuntu安装完mysql发现关机非常慢,查看日志可以看到

1
2
3
4
5
6
7
8
9
1月 04 15:44:58 systemd[1]: Starting MySQL Community Server...
1月 04 15:44:58 systemd[1]: Started MySQL Community Server.
1月 03 22:05:40 systemd[1]: Stopping MySQL Community Server...
1月 03 22:15:40 systemd[1]: mysql.service: State 'stop-sigterm' timed out. Killing.
1月 03 22:15:40 systemd[1]: mysql.service: Killing process 1137 (mysqld) with signal SIGKILL.
1月 03 22:15:40 systemd[1]: mysql.service: Killing process 1197 (mysqld) with signal SIGKILL.
1月 03 22:15:40 systemd[1]: mysql.service: Main process exited, code=killed, status=9/KILL
1月 03 22:15:40 systemd[1]: mysql.service: Failed with result 'timeout'.
1月 03 22:15:40 systemd[1]: Stopped MySQL Community Server.

准确说关机需要10分钟

解决方案

1

1
systemctl disable mysql

禁用mysql的自启动,需要时再打开mysql服务

2

Systemd Mysql won’t stop

我没试过,一看这么繁就不想尝试了