[ERROR] InnoDB: Unable to lock ./ibdata1, error: 11

parknkjun發表於2015-05-20
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部落格 ” ,連結:http://blog.itpub.net/10271187/viewspace-1663122/,如需轉載,請註明出處,否則將追究法律責任。

相關文章