Fresh Install: MySQL Fails on boot, but succeeds on restart

geddes2

Member
Jun 19, 2006
9
0
151
Hello all, thank you for your help in the past, andd thank you in advance for taking the time to help with this latest problem.

On two seperate servers I have the same problem, both are running RHEL 3. I install CPanel using layer1.cpanel.net/latest, everything works great, and then eventually I reboot my server. While booting, mysql fails to start, but after booting, I can log in and run /scripts/restartsrv_mysql and mysql starts up without a problem.

So, I guess the question is, what does /scripts/restartsrv_mysql do right that /etc/init.d/mysql does wrong, and how can I fix that? I tried looking at the various scripts, and determined that one problem might be that the /etc/init.d/mysql script does not specify a basedir, but I have no idea what that basedir should be, since I don't even find a basedir line in Cpanel's script.

I thought maybe the problem was that mysql was starting too early, but when I upped its number in rc3.d it still failed, albeit later in the boot process.

Any insights into the problem would be appreciated.

Thanks,
- Geddes
 

Rafaelfpviana

Well-Known Member
Mar 12, 2004
141
0
166
Brazil
Well, first of all I recommend that you put this in your /etc/my.cnf

[safe_mysqld]
err-log=/var/log/mysqld.log
That way you will know if the server is trying to start mysql and if something happens in the process.

Next, check if mysql is in chkconfig, to check do this:

[email protected] [~]# chkconfig --list|grep mysql
mysql 0: off 1: off 2: on 3: on 4: on 5: on 6: off
If you don't get a result like mine you can add mysql in chkconfig like this:
[email protected] [~]# chkconfig --add mysql
Then add the runlevels to be checked if mysql stared and if it isn't running it will try to start it.
[email protected] [~]# chkconfig --level 2345 mysql on
Next time you reboot the server take a look the the log in /var/log/mysqld.log and if something went wrong you will know.

Hope I helped you out.
Have a good day.
 
Last edited:

geddes2

Member
Jun 19, 2006
9
0
151
Thanks for your help, looking at the log showed that on boot mysql was having problems writing to /tmp

Then i looked at my fstab to find that cpanel had deleted my /tmp! Then I looked at local.rc, and found that cpanel runs a script called /scripts/securetmp that creates one on the fly on booting, but in rc3 it runs as S99, which is after mysql, which was at S64, and thus the problem. To fix, I just removed mysql from rc3.d and put the start command in the rc.local after the securetmp had been set up.

- Geddes
 

archimedes79

Registered
May 1, 2007
2
0
151
I just read this and it worked for me. The exact commands are like this.

rm /etc/rc3.d/S64mysql

vi /etc/rc.local

(add this line to the bottom of the file)
/etc/init.d/mysql start

(save and exit with this command)
:wq

Then reboot
 

archimedes79

Registered
May 1, 2007
2
0
151
After doing this, cpanel still would not start on boot so I did the same with the cpanel startup script.

rm /etc/rc3.d/S95cpanel

vi /etc/rc.local

(add this line)
/etc/init.d/cpanel start

(save)
:wq

restart.