LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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


Reply
  Search this Thread
Old 05-01-2012, 12:02 PM   #1
chanjay
LQ Newbie
 
Registered: Jun 2011
Posts: 13

Rep: Reputation: Disabled
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.
 
Old 05-01-2012, 12:03 PM   #2
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,465

Rep: Reputation: 2069Reputation: 2069Reputation: 2069Reputation: 2069Reputation: 2069Reputation: 2069Reputation: 2069Reputation: 2069Reputation: 2069Reputation: 2069Reputation: 2069
You could put the "/etc/init.d/mysqld restart" call in the startup script. Where the startup script is located depends on your distro.
 
Old 05-01-2012, 05:01 PM   #3
Satyaveer Arya
Senior Member
 
Registered: May 2010
Location: Palm Island
Distribution: RHEL, CentOS, Debian, Oracle Solaris 10
Posts: 1,415

Rep: Reputation: 305Reputation: 305Reputation: 305Reputation: 305
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.
 
Old 05-01-2012, 06:33 PM   #4
whysoserious
Member
 
Registered: May 2012
Location: London
Distribution: Debian and slackware for uni
Posts: 61

Rep: Reputation: Disabled
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.
 
Old 05-01-2012, 06:37 PM   #5
whysoserious
Member
 
Registered: May 2012
Location: London
Distribution: Debian and slackware for uni
Posts: 61

Rep: Reputation: Disabled
Quote:
Originally Posted by suicidaleggroll View Post
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.
 
Old 05-02-2012, 10:01 AM   #6
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,465

Rep: Reputation: 2069Reputation: 2069Reputation: 2069Reputation: 2069Reputation: 2069Reputation: 2069Reputation: 2069Reputation: 2069Reputation: 2069Reputation: 2069Reputation: 2069
Quote:
Originally Posted by whysoserious View Post
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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] server automatically rebooted mahmoodn Ubuntu 4 10-29-2011 02:15 AM
Unix server restart automatically ganesh24pal@gmail.com Linux - Server 1 07-04-2011 03:41 AM
How can I monitor services such as apache and mysql, and restart them automatically? abefroman Linux - Software 3 05-21-2008 10:06 PM
Automatically Restart Server?? flamesrock Linux - Software 4 08-07-2004 09:25 PM
rebooted server but it didn't restart! ? tester Linux - Newbie 0 08-29-2001 05:51 PM


All times are GMT -5. The time now is 11:58 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration