0

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.

Mei
  • 4,590
  • 8
  • 45
  • 53
ThinkingMonkey
  • 476
  • 1
  • 9
  • 18

1 Answers1

3

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

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

chkconfig --list <servicename> 

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 found in /etc/init.d.

Ex:

chkconfig --add mysql.server

Wikipedia has more information on run levels.

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.

Mei
  • 4,590
  • 8
  • 45
  • 53
ckliborn
  • 2,778
  • 4
  • 25
  • 37
  • `mysql.server` script says: `# Default-Start: 2 3 4 5` `# Default-Stop: 0 1 6` where as the `chkconfig --list` does not list `mysql` at all though `S98mysql` is present in `cd /etc/rc.d/rc5.d/`. – ThinkingMonkey Jan 12 '12 at 18:41
  • The start levels in the script are what chkconfig uses for default values. Try adding the service with "chkconfig --add mysql.server" Also you can set a list of all the services that are managed with chkconfig by running "chkconfig --list" – ckliborn Jan 12 '12 at 18:44
  • hmmm looking into it. – ThinkingMonkey Jan 12 '12 at 18:45
  • 1
    did this `chkconfig --add mysql.server` and a reboot to my system. MySQL is starting as expected. Thank you. – ThinkingMonkey Jan 12 '12 at 18:52