Ubuntu – the difference between “systemctl start” and “systemctl enable”

mariadbsystemd

I installed MariaDB-server to my machine. While setting up I met with a problem whether I have to enable it all the time as the document I follow is given with these steps,

sudo yum install mariadb mariadb-server 
sudo systemctl start mariadb.service  
sudo systemctl enable mariadb.service

Best Answer

systemctl start and systemctl enable do different things.

enable will hook the specified unit into relevant places, so that it will automatically start on boot, or when relevant hardware is plugged in, or other situations depending on what's specified in the unit file.

start starts the unit right now.

disable and stop are the opposite of these, respectively.

This means that when you first install MariaDB, you might want to run systemctl enable mariadb.service to enable it so it starts on boot. You might also want to run systemctl start mariadb.service, or just reboot, in order to start MariaDB. To stop MariaDB, run systemctl stop mariadb.service (it will start again on next boot or when you manually start it). To disable it so it doesn't start on boot anymore, run systemctl disable mariadb.service.

Source: systemctl man page

Related Question