Comment 16 for bug 551130

Revision history for this message
StephanNies (nies-stephan) wrote : Re: infinite loop in /etc/init/mysql.conf if mysqld is not running.

Please note that the cause of the problem is that /etc/init/mysql.conf is trying to start mysqld as user root. If you start as user mysql everything works fine.

The infinte loop described above in

 while ! /usr/bin/mysqladmin --defaults-file=$HOME/debian.cnf ping
    do
        sleep 1
    done

is caused by mysqld not running and therefore /usr/bin/mysqladmin --defaults-file=$HOME/debian.cnf ping
failing.
With no proper timeout this causes an infinte loop.

So you have to apply the following 2 fixes to /etc/init/mysql.conf:

1) to make msqld work:

exec sudo -u mysql /usr/sbin/mysqld # <- important execute as use mysql

2) to make sure the loop times out:

   count=0
   while [ $count -lt 10 ] && ! /usr/bin/mysqladmin --defaults-file=/etc/mysql/debian.cnf ping 2>/dev/null
   do
       echo "waiting for mysqld: ${count}s ..."
       sleep 1
       count=`expr $count + 1`
   done

   if [ $count -eq 10 ]
   then
       echo "timeout."
   else
       exec $HOME/debian-start
   fi