我的电脑上有 MySQL,用于开发目的,但大多数时候我都不使用它。如何配置我的 Debian,使其在启动时不启动 MySQL,而只有当我告诉它(使用service mysql start
)时才启动。
我对 apache2 做了同样的事情,使用
update-rc.d -f apache2 remove
但是我找不到使用 MySQL 来实现这一点的方法。
答案1
你想要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
答案3
update-rc.d -f mysql remove
或者:
update-rc.d mysql disable