Debian-在启动时阻止MySQL启动


8

我出于开发目的在计算机上安装了MySQL,但大多数时候我不使用它。我如何配置我的Debian,以便它不会在启动时启动MySQL,而只有在我告诉它(使用service mysql start)时才启动。

我对apache2做过同样的事情,

 update-rc.d -f apache2 remove

但是我找不到用MySQL做到这一点的方法。

Answers:


16

你要update-rc.d mysql disable。如update-rc.d联机帮助页所述,您不想删除:

A common system administration error is to delete the links with the thought that this will "disable" the service, i.e., that this will pre‐ vent the service from being started. However, if all links have been deleted then the next time the package is upgraded, the package's postinst script will run update-rc.d again and this will reinstall links at their factory default locations


2

由于Debian 8(Jessy)默认使用systemd,因此请尝试以下操作:

systemctl list-units | grep mysql    # check for mysql unit name
systemctl disable mysql.service      # or whatever you find at prev step

1
update-rc.d -f mysql remove

要么:

update-rc.d mysql disable
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.