Linux – How to automatically start thesql after server restart (CentOS + other distros)

init.dlinuxMySQL

How would I configure my CentOS Linux server to automatically start mysql when the server is started following a shutdown?

I'm aware of the init.d path…

/etc/rc.d/init.d

…and I can see mysqld in this folder. I believe that placing items (i.e. by symbolic link) in this folder means that they should start on server restart.

But this did not happen for me.

Background

Our central IT desk restarted our virtualised CentOS servers over the weekend. The server was available following restart but the MySQL database had not restarted also.

Thoughts?

Best Answer

Use chkconfig:

chkconfig --level 345 mysqld on