How to automatically restart MySQL after server rebooted?
Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
How to automatically restart MySQL after server rebooted?
Hi,
I have a web site that uses MySQL database. My problem is whenever the web server got rebooted, I have to manually restart the MySQL server (/etc/init.d/mysqld restart) otherwise the web site does not work.
Is there a way to do automatic restart to the MySQL after the web server has rebooted?
Distribution: RHEL, CentOS, Debian, Oracle Solaris 10
Posts: 1,420
Rep:
Just use chkconfig mysqld on only one time. And whenever the server gets reboot, it will automatically restart the mysqld service.
You can also check the man page of chkconfig command to run the service on particular runlevels only according to your need.
By default it will start on runlevel 2, 3, 4 & 5.
Last edited by Satyaveer Arya; 05-01-2012 at 06:04 PM.
Install webmin. There is an option to set the mysql server to start at boottime when you click on the servers module on the left. Also it enables a lot of other tasks to be done quickly! Hope that helped.
Would it not be dependant on the distro sir. I think it would be start instead of restart or does that not make a difference.
The location of the startup script would depend on the distro. The command for starting/restarting the mysql service I just grabbed from his original post. For an initial start, yes "start" would be more correct, but "restart" should still do the job.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.