1829606 Members
1317 Online
109992 Solutions
New Discussion

Re: MySQL Auto Start?

 
Tamer Shaalan
Regular Advisor

MySQL Auto Start?

Dear All,

I'm using SUSE Linux Enterprise Server v. 9.0, with MySQL 5.0. How to make mysqld to start automatically with system boot? I make it manually each time restart my box.

10 points for ALL right answers!!!!

Thanks,

Tamer.
Success is a journey, not a destination
6 REPLIES 6
Ivan Ferreira
Honored Contributor

Re: MySQL Auto Start?

The mysql package contains an rc init script to start the service.

Place the script into the /etc/init.d directory, then identify your current runlevel with the runlevel command, then create a symbolic link to the appropiate directory under /etc/init.d/rcX.d or in /etc/init.d/boot.d, for example:

ln -s /etc/init.d/mysqld /etc/init.d/rc5.d/S99mysqld
Por que hacerlo dificil si es posible hacerlo facil? - Why do it the hard way, when you can do it the easy way?
Steven E. Protter
Exalted Contributor

Re: MySQL Auto Start?

Shalom Tamer,

If you installed mysql from an rpm or automated package, then it should automatically set up the rc scripts.

If however you compiled it, you need to do this manually.

1) create a startup script in /etc/init.d

This script must have a start and a stop section and can be copied from another script. A script may be delivered with mysql, if so that should be used.

For assumption purposes call the script mysqld
/etc/init.d/mysqld

chkconfig --list | grep mysqld

Check the status of mysqld

chkconfig mysqld on

to set it to auto start if its already a service.
#manual procedure
cd /etc/rc5.d
# run level 5
ln -s /etc/init.d/mysqld S99mysqld
cd /etc/rc4.d
ln -s /etc/init.d/mysqld K01mysqld

This sets mysqld to (S)tart at run level 5 and be (K)illed at run level 4.

That should be sufficient.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Tamer Shaalan
Regular Advisor

Re: MySQL Auto Start?

Thanks Sep and lvan,

I installed MySQL 5.0 from rpm package, and actually there is a script to start and stop it but I noticed that during booting, it fails when trying to start MySQL!!! I want to know why? also I want to know what is meant by k(xy) and s(xy)?

N.B: all point will be assigned just having it fixed. :)

Thanks

Tamer.
Success is a journey, not a destination
Ivan Ferreira
Honored Contributor

Re: MySQL Auto Start?

Run the script manually, by issuing

/etc/init.d/mysql start

Or wherever it is located.

Chech the mysql log, and post the results.

You should verify the contents of the script, chech the start section, and ensure that the command used to start is the command that you are using currently to start it manually.
Por que hacerlo dificil si es posible hacerlo facil? - Why do it the hard way, when you can do it the easy way?
Tamer Shaalan
Regular Advisor

Re: MySQL Auto Start?

Dear lvan,

I use
#mysqld --user=root --old_password

to start MySQL with old password hashing algorithm. I use old_password argument because I had an error from MySQL while installing bugzilla server that pain at authentication protocol used by server (although both client & server modules are of version 5.0).
When I tried to run script manually I had filed response. I feel there is somthing in database and I'm afraid because this is the installation of a server in production environment!!!
I tried uninstalling MySQL and reinstalling it many times but with the same results.
Where can I find MySQL log? I searched in /var/log but nothing is found!!!

Tamer.
Success is a journey, not a destination
Ivan Ferreira
Honored Contributor

Re: MySQL Auto Start?

The log is normally located at the /var/lib/mysql directory, or /var/log/mysql, but it depends of the distribution and the --debug parameter.

You can also create your own startup script, very easily:

case $1 in

start)
commands to start database
;;
stop)

commands to stop database
;;

status)

commands to verify the status
;;

esac
Por que hacerlo dificil si es posible hacerlo facil? - Why do it the hard way, when you can do it the easy way?