[nSLUG] common issue with mysql 4.1 init.d script

Donald Teed donald.teed at gmail.com
Tue Jun 14 23:27:36 ADT 2005


Still finding some oddities in my set up.  One solved issue was
that mysql wasn't starting at boot up, but would if I ran
/etc/init.d/mysql start

It seems this is a problem with the init script in several distros,
for mysql 4.1.

The problem only appears after making mysql more secure by assigning
a password to user root.  Out of the box mysql runs with no password for root.

The start up failure is stemming from this line in mysql init script:
    ping_output=`$MYADMIN ping 2>&1`; ping_alive=$(( ! $? ))

That runs mysqladmin.  It complains that it can't do that as user root without
a password, and that generates other errors from the script:

 /usr/bin/mysqladmin: connect to server at 'localhost' failed
error: 'Can't connect to local MySQL server through socket
'/var/run/mysqld/mysqld.sock' (2)'
Check that mysqld is running and that the socket:
'/var/run/mysqld/mysqld.sock' exists!

The solution is to make it check as another user:
    ping_output=`$MYADMIN ping -u UNKNOWN_USER 2> /dev/null`;
ping_alive=$(( ! $? ))

This makes it quiet, and the service starts, even with all of these seemingly
strange checks and double checks in the init script.

!DSPAM:42af921765132362818108!




More information about the nSLUG mailing list