Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How make mysql start automatically ? (linux-cli only)

How can i make mysql start every time the system boot ? I need that in a dedicated server(ubuntu distro) in which i have my blog, but every time the server goes down, on booting mysql is stopped. Btw i can use only command line.

like image 493
vasilakisfil Avatar asked Mar 25 '12 10:03

vasilakisfil


People also ask

How do I start MySQL automatically?

On Windows, you can set up a MySQL service that runs automatically when Windows starts. See Section 2.3. 4.8, “Starting MySQL as a Windows Service”. On Unix and Unix-like systems, you can invoke mysqld_safe, which tries to determine the proper options for mysqld and then runs it with those options.

How do I stop MySQL from opening on startup Linux?

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.


2 Answers

update-rc.d allows setting init script links on Ubuntu and Debian Linux systems to control what services are run by init when entering various runlevels. It should be able to add mysql to the list of services to run at boot:

sudo update-rc.d mysql defaults 

If you later want to disable running mysql on bootup:

sudo update-rc.d mysql remove 
like image 101
inquiryqueue Avatar answered Sep 20 '22 06:09

inquiryqueue


You can do it by using sysv-rc-conf, on debian based you can install it with sudo apt-get install sysv-rc-conf then you can choose what start at boot with a simple X on the name of the deamon, all via command line

enter image description here

like image 41
Christian Giupponi Avatar answered Sep 22 '22 06:09

Christian Giupponi