How to disable MySQL server from constantly running in the background?

This website explains MySQL server installation in Ubuntu 18.04. Basically you issue the command sudo apt install mysql-server. The same website then explains that:

Once the installation is completed, the MySQL service will start automatically. To check whether the MySQL server is running, type: sudo systemctl status mysql

Does this imply that once I install mysql-server it will always be running in the background unless I explicitly kill the process upon each reboot?

I want to play around with mysql-server occasionally, but don't want it constantly running in the background.


Solution 1:

Does this imply that once I install mysql-server it will always be running in the background

Yes.

unless I explicitly kill the process upon each reboot?

No, never ever ever kill mysql. Killing it can damage your database.

  • sudo service mysql stop will stop the current session
  • sudo systemctl disable mysql to prevent it starting on boot. That is done once and makes it disabled each boot. sudo service mysql start will start mysql when disabled.