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.


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

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


Run the following command to see your mysql current status:

/sbin/chkconfig mysqld --list

it will return a line such as below:

 mysqld             0:off   1:off   2:off   3:off   4:off   5:off   6:off

to make mysql start every time the system boots, type the following:

 sudo /sbin/chkconfig mysqld on

Result now from '--list' is:

mysqld          0:off   1:off   2:on    3:on    4:on    5:on    6:off

No answer helped. Finally chkconfig and update-rc.d did not work with MySQL on my machine.

Solution, I had a file /etc/init/mysql.override which contained

manual

i just deleted that file

$ sudo rm /etc/init/mysql.override

Deleting /etc/init/mysql.override did the job in my case (HostEurope VPS with Ubuntu 12.04)