ハイパーニートプログラマーへの道

頑張ったり頑張らなかったり

【Ubuntu 16.04】MySQLを自動起動できるようにする

sysv-rc-confのインストール

$ sudo apt-cache search sysv-rc-conf
sysv-rc-conf - SysV init runlevel configuration tool for the terminal
$ sudo apt-get install sysv-rc-conf

mysql自動起動設定

$ sudo sysv-rc-conf --list
(中略)
mysql # なんにもない
$ sudo sysv-rc-conf mysql on
$ sudo sysv-rc-conf --list | grep mysql
mysql        2:on  3:on   4:on   5:on

vagrant上にUbuntuを入れているので、一旦 exit -> vagrant halt する。
そしてvagrantにログインしなおすと

$ sudo service mysql status
● mysql.service - LSB: Start and stop the mysql database server daemon
   Loaded: loaded (/etc/init.d/mysql; bad; vendor preset: enabled)
   Active: active (exited) since Sat 2017-03-04 02:10:14 UTC; 8min ago
...

active になっている。

参考記事:

Ubuntu 14.04 LTSでApache2やMySQLを自動起動する設定 - PHPやるお

当たって砕け散れ [mysql]ubuntuへmysqlの自動起動の登録