MySQL 不断崩溃:InnoDB:无法锁定 ./ibdata1,错误:11

MySQL 不断崩溃:InnoDB:无法锁定 ./ibdata1,错误:11

我有一个简单的网络服务器(Debian 6.0 x86,DirectAdmin,1 GB 内存,仍有 10 GB 可用空间,mySQl 版本 5.5.9),但是 mySQL 服务器一直崩溃,我需要终止所有 mySQL 进程才能重新启动它。

/var/log/mysql-error.log输出:

130210 21:04:26 InnoDB: Using Linux native AIO
130210 21:04:34 InnoDB: Initializing buffer pool, size = 128.0M
130210 21:05:42 InnoDB: Completed initialization of buffer pool
130210 21:05:48 InnoDB: Initializing buffer pool, size = 128.0M
130210 21:06:22 InnoDB: Initializing buffer pool, size = 128.0M
130210 21:06:27 mysqld_safe mysqld from pid file /usr/local/mysql/data/website.pid ended
130210 21:06:29 mysqld_safe mysqld from pid file /usr/local/mysql/data/website.pid ended
130210 21:07:22 InnoDB: Completed initialization of buffer pool
130210 21:07:51 mysqld_safe mysqld from pid file /usr/local/mysql/data/website.pid ended
130210 21:08:33 InnoDB: Completed initialization of buffer pool
130210 21:12:03 [Note] Plugin 'FEDERATED' is disabled.
130210 21:12:47 InnoDB: The InnoDB memory heap is disabled
130210 21:12:47 InnoDB: Mutexes and rw_locks use InnoDB's own implementation
130210 21:12:47 InnoDB: Compressed tables use zlib 1.2.3
130210 21:12:47 InnoDB: Using Linux native AIO
130210 21:13:11 InnoDB: highest supported file format is Barracuda.
130210 21:13:23 InnoDB: Initializing buffer pool, size = 128.0M
InnoDB: The log sequence number in ibdata files does not match
InnoDB: the log sequence number in the ib_logfiles!
130210 21:14:05  InnoDB: Database was not shut down normally!
InnoDB: Starting crash recovery.
InnoDB: Unable to lock ./ibdata1, error: 11
InnoDB: Check that you do not already have another mysqld process
InnoDB: using the same InnoDB data or log files.
InnoDB: Unable to lock ./ibdata1, error: 11
InnoDB: Check that you do not already have another mysqld process
InnoDB: using the same InnoDB data or log files.
InnoDB: Unable to lock ./ibdata1, error: 11
InnoDB: Check that you do not already have another mysqld process
InnoDB: using the same InnoDB data or log files.
130210 21:17:53  InnoDB: Unable to open the first data file
InnoDB: Error in opening ./ibdata1
130210 21:17:53  InnoDB: Operating system error number 11 in a file operation.

我在 mySQL 网站上找到了一个主题这里然而没有解决办法。

有人有什么想法吗?

答案1

同一博客中的一条评论提出了另一种方法:

这对我有帮助:

lsof -i:3306

然后杀死它(进程号)

杀死-9进程

例如 kill -9 13498

然后尝试再次重新启动 MySQL。

通过http://www.webhostingtalk.com/archive/index.php/t-1070293.html

答案2

使用 ubuntu 14.04。当我尝试通过以下方式重新启动时,我遇到了这个问题

/etc/init.d/mysql restart

相反尝试

service mysql restart 

答案3

解决方案

复制原始文件(ibdata1、ib_logfile0、ib_logfile1……)。

mv ibdata1 ibdata1.bak 
cp -a ibdata1.bak ibdata1

http://cglreport.zhenhua.info/2008/08/mysql-error-unable-to-lock-ibdata1.html

归档链接:https://web.archive.org/web/20120718013320/http://cglreport.zhenhua.info/2008/08/mysql-error-unable-to-lock-ibdata1.html

答案4

这帮助我解决了这个问题:

删除所有 ibdata 文件并让 mysql 创建它们。

停止mysql:

service mysql stop

进入mysql库:

cd /var/lib/mysql/

将 innodb 文件移动到某个地方以备不时之需:

mv ib* /root/

启动mysql:

service mysql start

相关内容