Fix mysql initscript failure when anonymous users are disabled (bz#142328)

This commit is contained in:
Tom Lane 2004-12-10 19:09:25 +00:00 committed by Michal Schorm
parent e5953bdf85
commit f681a34ca5

View File

@ -37,19 +37,18 @@ start(){
chmod 0755 $datadir chmod 0755 $datadir
/usr/bin/mysqld_safe --defaults-file=/etc/my.cnf >/dev/null 2>&1 & /usr/bin/mysqld_safe --defaults-file=/etc/my.cnf >/dev/null 2>&1 &
ret=$? ret=$?
# If you've removed anonymous users, this line must be changed to # Spin for a maximum of N seconds waiting for the server to come up.
# use a user that is allowed to ping mysqld. # Rather than assuming we know a valid username, accept an "access
ping="/usr/bin/mysqladmin -uUNKNOWN_MYSQL_USER ping" # denied" response as meaning the server is functioning.
# Spin for a maximum of ten seconds waiting for the server to come up
if [ $ret -eq 0 ]; then if [ $ret -eq 0 ]; then
for x in 1 2 3 4 5 6 7 8 9 10; do STARTTIMEOUT=10
if [ -n "`$ping 2> /dev/null`" ]; then while [ $STARTTIMEOUT -gt 0 ]; do
break; RESPONSE=`/usr/bin/mysqladmin -uUNKNOWN_MYSQL_USER ping 2>&1` && break
else echo "$RESPONSE" | grep -q "Access denied for user" && break
sleep 1; sleep 1
fi let STARTTIMEOUT=${STARTTIMEOUT}-1
done done
if !([ -n "`$ping 2> /dev/null`" ]); then if [ $STARTTIMEOUT -eq 0 ]; then
echo "Timeout error occurred trying to start MySQL Daemon." echo "Timeout error occurred trying to start MySQL Daemon."
action $"Starting $prog: " /bin/false action $"Starting $prog: " /bin/false
else else