当前位置: 首页 > 数据库 > MySQL教程 > 正文

Timeout error occurred trying to start MySQL Daemon

时间:2010-09-06

#/etc/init.d/MySQLd restart

stopping mysql   [ok]

Timeout error occurred trying to start MySQL Daemon. [failure] 

但是这个时候mysql实际上已经起动了,因为用netstat -ln命令去看3306端口已经起动.使用mysql -u root -p password也能连接到数据库.

解决方法:

修改/etc/init.d/mysqld.

在mysql里创建dameon用户,然后再修改/etc/init.d/mysqld.

具体操作如下:

我们不妨先看看/etc/init.d/mysqld起动脚本是如何工作的,注意下面的一段

# 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
    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
      done
      if !([ -n "`$ping 2> /dev/null`" ]); then
          echo "Timeout error occurred trying to start MySQL
Daemon."          action $"Starting $prog: " /bin/false
      else
          action $"Starting $prog: " /bin/true
      fi
    else
      action $"Starting $prog: " /bin/false
    fi
    [ $ret -eq 0 ] && touch /var/lock/subsys/mysqld
    return $ret