Gossamer Forum
Home : Products : Gossamer Links : Version 1.x :

start mysql when server reboots?

Quote Reply
start mysql when server reboots?
Does anyone know how to make mysql restart automatically if the server reboots?

All I could get from the mysql documentation was to use mysql.server but no detailed instructions except to put it in /etc/init.d with a link to /etc/rc3.d/s99mysql

The other way is to start external scripts using /etc/rc.local and adding in

/bin/sh -c 'cd /usr/local/mysql ; ./bin/safe_mysqld &'

Would option 2 work?

Just getting ready for New Years when things shut down.

Kevin
Quote Reply
Re: start mysql when server reboots? In reply to
What OS are you using? The exact procedure varies from OS to OS, but the principles are the same.

On Solaris 7, I have the following file, called "MySQL" in the /etc/init.d folder


Code:
#!/bin/sh
# MySQL Startup

case "$1" in
'start')
cd /usr/local/mysql
./bin/safe_mysqld &
;;
'stop')
;;
*)
echo "Usage: $0 { start | stop }"
;;
esac
exit 0


Also, there is an alias set up in the /etc/rc2.d folder called S99MySQL that links to the above file in that location.

I used a config program to do this and it created the alias when I entered the start up code, and I'm not sure those are optimal for my system, but they work. I've shut down and rebooted a dozen times without a problem (KEW - Knock Electronic Wood)

Quote Reply
Re: start mysql when server reboots? In reply to
I am using Linux with Apache.

Do you think it would be the same code for my system?

I'll try it after Dec 31 to see if it works.

I'll the second option for now and hope it works.

Thanks,

Kevin
Quote Reply
Re: start mysql when server reboots? In reply to
only if my host knows how to do that.. whenever they reboot.. i have to email them to start mysql.. Smile

i'll be on a dedicated soon though

jerry
Quote Reply
Re: start mysql when server reboots? In reply to
My server has been up for 85 days, and it would have been twice as long, except I was trying to elimiate a network bug by making sure it wasn't somehow my server (shades of coming from a windows environment).

At first I just started MySQL by myself... manually as root. It's not difficult at all, and since a server restart is an uncommon event, it doesn't happen often. I put the auto-start in to test a new config program. As often as I've had to restart my server, manually starting MySQL and running the test program gave me some confidence.

I really love Unix for the server, and would not switch to NT if I was forced to -- I'd probably quit and find another line of work.