如何从 Ubuntu 18.04 中完全删除 mysql?

如何从 Ubuntu 18.04 中完全删除 mysql?

我已从 XUbuntu 18.04 卸载了 mysql,步骤如下:

sudo apt remove --purge mysql*
sudo apt autoremove
sudo rm /etc/init.d/mysql
sudo systemctl daemon-reload 

我备份了 /etc/init.d/mysql

此后,mysql 已从 CLI 中删除。我确认了这一点:

$ sudo systemctl start mysql
Failed to start mysql.service: Unit mysql.service not found.

问题:

为什么看起来该服务仍在运行?

我还需要做什么才能完全卸载 mysql?

这是 sudo systemctl status mysql 的输出:

$ sudo systemctl status mysql
● mysql.service
  Loaded: not-found (Reason: No such file or directory)
  Active: failed (Result: exit-code) since Fri 2019-04-26 16:02:03 CDT;  24s ago

abr 26 16:02:03 dell4 systemd[1]: Starting LSB: Start and stop the    mysql database server daemon...
abr 26 16:02:03 dell4 systemd[16668]: mysql.service: Failed to execute command: No such file or directory
abr 26 16:02:03 dell4 systemd[16668]: mysql.service: Failed at step  EXEC spawning /etc/init.d/mysql: No such file or directory
abr 26 16:02:03 dell4 systemd[1]: mysql.service: Control process exited, code=exited status=203
abr 26 16:02:03 dell4 systemd[1]: mysql.service: Failed with result 'exit-code'.
abr 26 16:02:03 dell4 systemd[1]: Failed to start LSB: Start and stop the mysql database server daemon.

我期望它是:

Unit mysql.service could not be found.

先感谢您 !

答案1

从输出中可以清楚地看出,MySQL 已被完全删除,并且 systemctl 无法加载和启动该服务。每当修改或删除服务时,都必须刷新 systemctl。要刷新,请运行:

sudo systemctl daemon-reload

但出于某种原因,它没有刷新。在这种情况下,重新启动会有所帮助。重新启动系统会彻底刷新 systemctl。

相关内容