Mysql

Debian - 在啟動時阻止 MySQL 啟動

  • December 15, 2017

我的電腦上有 MySQL 用於開發目的,但大多數時候我不使用它。如何配置我的 Debian,使其不會在啟動時啟動 MySQL,但只有在我告訴它(使用service mysql start)時才啟動。

我對apache2做了同樣的事情,

update-rc.d -f apache2 remove

但是我找不到使用 MySQL 的方法。

你想要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

由於 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

引用自:https://serverfault.com/questions/419759