Jan 12, 2012
tom

MySql not starting during startup even after adding symlink to rc5.d

Question

I recently added mysql.server to start during the start up by doing this:

cd /etc/rc.d/rc5.d/
ln -s  /etc/init.d/mysql.server S98mysql

I have perhaps not correctly understood the <number> part of s<number>script / k<number>script naming convention for the RC scripts.

Although, I know that it’s for: representing the order in which the script will be executed during the run of runlevel control script.

Picked up S98mysql from: How To Install MySQL : 6.0 Automatic MySQL Start-up during boot

But MySQL does not start during startup. Will show this message when trying to connect (as expected):

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)

Works fine if I do a manual start with: /etc/init.d/mysql.server start
What am I doing wrong?

I am using Fedora 15.

Answer

If you are using Fedora you might want to use chkconfig.

http://linuxcommand.org/man_pages/chkconfig8.html

To see what run levels a particular service is enabled for, you can do something like this

chkconfig –list
Ex:
chkconfig –list mysqld

To change the behavior for certain run levels for a service you can do something like this:

chkconfig –levels 345 mysqld on
or since your init.d script has a different name
chkconfig –levels 345 mysql.server on

If a service isn’t listed in chkconfig you can add it with the –add flag. Use the script name in /etc/init.d

Ex:
chkconfig –add mysql.server

Here is some more information on run levels:
http://en.wikipedia.org/wiki/Runlevel

Most servers only go to run level 3 which would mean that run level 5 is not reached so the service would not be started in your example.

Most desktops go to run level 5 since that is when the graphical interface (X) starts

No related posts.

Leave a comment