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