Linux - Newbie This 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.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
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.
|
|
05-01-2012, 12:02 PM
|
#1
|
LQ Newbie
Registered: Jun 2011
Posts: 13
Rep:
|
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?
Thanks.
hc.
|
|
|
05-01-2012, 12:03 PM
|
#2
|
LQ Guru
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,573
|
You could put the "/etc/init.d/mysqld restart" call in the startup script. Where the startup script is located depends on your distro.
|
|
|
05-01-2012, 05:01 PM
|
#3
|
Senior Member
Registered: May 2010
Location: Palm Island
Distribution: RHEL, CentOS, Debian, Oracle Solaris 10
Posts: 1,420
|
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 05:04 PM.
|
|
|
05-01-2012, 06:33 PM
|
#4
|
Member
Registered: May 2012
Location: London
Distribution: Debian and slackware for uni
Posts: 61
Rep:
|
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.
|
|
|
05-01-2012, 06:37 PM
|
#5
|
Member
Registered: May 2012
Location: London
Distribution: Debian and slackware for uni
Posts: 61
Rep:
|
Quote:
Originally Posted by suicidaleggroll
You could put the "/etc/init.d/mysqld restart" call in the startup script. Where the startup script is located depends on your distro.
|
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.
|
|
|
05-02-2012, 10:01 AM
|
#6
|
LQ Guru
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,573
|
Quote:
Originally Posted by whysoserious
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.
|
|
|
All times are GMT -5. The time now is 05:37 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|