How to stop mysql from running at boot time?

Since 15.04 you can simply do:

sudo systemctl disable mysql

To prevent mysql from starting on boot:

  1. Open the terminal: Ctrl+Alt+T

  2. Open the mysql.conf file: nano /etc/init/mysql.conf

  3. Comment out the start on line near the top of the file, the start on might be spread across two lines, so comment out both. (comment adding # at the beginning)

If you want to manually start mysql, use the following command:

service mysql start

Taken liberally from here.


In Ubuntu 18.04, sudo systemctl disable mysql will prevent mysql-server from autostarting on boot.

For linux, there are 3 main init systems: Systemd, Upstart and SysV. Although nearly all Linux systems run on Systemd. The other two init systems might also co-exist in your system.

For Systemd, use command sudo systemctl disable mysql;
For Upstart, use echo manual >> /etc/init/mysql.override;
For SysV, run the following command sudo update-rc.d mysql disable

If you'd like to find which init system is running on your server, please read this answer.

Tags:

Mysql

Boot