After adding MySQL to Ubuntu, it automatically starts up on server boot. I would like it to not start up with the system.

How can I disable it and manually start it?

2 Answers 2


MariaDB use systemd as does MySQL. To disable MySQL or MariaDB, from starting on bootup, run

systemctl list-unit-files '*mariadb*' '*mysql*'

If you see mysql.service, try disabling that one first.

sudo systemctl disable mysql

Now you can start and stop MySQL with

sudo systemctl stop mysql.service
sudo systemctl start mysql.service
  • You can always compile it from source and script the startup/shutdown. I like the fine-grained control this gives. I needed it for College where the only way I could run MySQL was to compile it and run it myself (no superuser privileges for me :-) )
    – Vérace
    Jun 3, 2018 at 6:20

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.