CentOS环境下启动mysql服务报错:
[root@jzh ~]# service mysql start
Starting MySQL.......................................................................................................... ERROR! The server quit without updating PID file (/var/lib/mysql/jzh.pid).
日志文件内容如下:
2015-05-19 09:28:19 11082 [ERROR] InnoDB: Unable to lock ./ibdata1, error: 11
2015-05-19 09:28:19 11082 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
2015-05-19 09:28:20 11082 [ERROR] InnoDB: Unable to lock ./ibdata1, error: 11
2015-05-19 09:28:20 11082 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
2015-05-19 09:28:21 11082 [ERROR] InnoDB: Unable to lock ./ibdata1, error: 11
2015-05-19 09:28:21 11082 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
2015-05-19 09:28:22 11082 [ERROR] InnoDB: Unable to lock ./ibdata1, error: 11
2015-05-19 09:28:22 11082 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
2015-05-19 09:28:23 11082 [ERROR] InnoDB: Unable to lock ./ibdata1, error: 11
2015-05-19 09:28:23 11082 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
2015-05-19 09:28:24 11082 [ERROR] InnoDB: Unable to lock ./ibdata1, error: 11
2015-05-19 09:28:24 11082 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
2015-05-19 09:28:25 11082 [ERROR] InnoDB: Unable to lock ./ibdata1, error: 11
2015-05-19 09:28:25 11082 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
2015-05-19 09:28:26 11082 [ERROR] InnoDB: Unable to lock ./ibdata1, error: 11
2015-05-19 09:28:26 11082 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
2015-05-19 09:28:27 11082 [ERROR] InnoDB: Unable to lock ./ibdata1, error: 11
2015-05-19 09:28:27 11082 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
2015-05-19 09:28:28 11082 [ERROR] InnoDB: Unable to lock ./ibdata1, error: 11
2015-05-19 09:28:28 11082 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
2015-05-19 09:28:29 11082 [ERROR] InnoDB: Unable to lock ./ibdata1, error: 11
2015-05-19 09:28:29 11082 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
2015-05-19 09:28:30 11082 [ERROR] InnoDB: Unable to lock ./ibdata1, error: 11
2015-05-19 09:28:30 11082 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
2015-05-19 09:28:31 11082 [ERROR] InnoDB: Unable to lock ./ibdata1, error: 11
2015-05-19 09:28:31 11082 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
2015-05-19 09:28:32 11082 [ERROR] InnoDB: Unable to lock ./ibdata1, error: 11
2015-05-19 09:28:32 11082 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
2015-05-19 09:28:33 11082 [ERROR] InnoDB: Unable to lock ./ibdata1, error: 11
2015-05-19 09:28:33 11082 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
错误显示不能lock ./ibdata1这个文件,建议检查是否有其他mysqld进程在使用相同的InnDB data或者日志文件,于是检查mysql相关进程:
[root@jzh ~]# ps -ef | grep mysql
root 1945 1 0 08:35 ? 00:00:00 /bin/sh /usr/bin/mysqld_safe --datadir=/var/lib/mysql --pid-file=/var/lib/mysql/jzh.pid
mysql 2079 1945 0 08:35 ? 00:00:05 /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib64/mysql/plugin --user=mysql --log-error=/var/lib/mysql/jzh.err --pid-file=/var/lib/mysql/jzh.pid
root 10935 2739 0 09:27 pts/1 00:00:00 /bin/sh /sbin/service mysql start
root 10940 10935 0 09:27 pts/1 00:00:00 /bin/sh /etc/init.d/mysql start
root 10948 10940 0 09:27 pts/1 00:00:00 /bin/sh /usr/bin/mysqld_safe --datadir=/var/lib/mysql --pid-file=/var/lib/mysql/jzh.pid
mysql 11082 10948 0 09:27 pts/1 00:00:00 /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib64/mysql/plugin --user=mysql --log-error=/var/lib/mysql/jzh.err --pid-file=/var/lib/mysql/jzh.pid
root 27245 23168 0 09:28 pts/2 00:00:00 grep mysql
果然有mysql进程已经启动了,kill掉,再启mysql服务成功
[root@jzh /]# service mysql start
Starting MySQL........................................................................................... SUCCESS!
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/10271187/viewspace-1663122/
,如需转载,请注明出处,否则将追究法律责任。