MySQL InnoDB:无法锁定 ./ibdata1 错误:35

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/33746484/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-31 21:24:23  来源:igfitidea点击:

InnoDB: Unable to lock ./ibdata1 error: 35

mysql

提问by Snowcrash

I'm trying to start MySQL in safe mode but the log file just keeps spitting out:

我正在尝试以安全模式启动 MySQL,但日志文件只是不断地吐出:

[ERROR] InnoDB: Unable to lock ./ibdata1 error: 35
[Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.

Notes:

笔记:

  1. I've stopped all mysql processes and have checked using the pscommand

  2. I've read this having repeated trouble with MySQL and Snow Leopard - Unable to lock ./ibdata1, error: 35

  1. 我已经停止了所有 mysql 进程并使用ps命令进行了检查

  2. 我读过这篇文章,反复遇到 MySQL 和 Snow Leopard 的问题 - 无法锁定 ./ibdata1,错误:35

采纳答案by Sasha Pachev

Strange error codes, both from MySQL and the operating system, can be explained by running a shell command perrorwhich is a part of MySQL distribution. On Linux, for example, perror 35returns OS error code 35: Resource deadlock avoided. I do not have an OSX system handy to test, but from this:

来自 MySQL 和操作系统的奇怪错误代码可以通过运行作为perrorMySQL 发行版一部分的shell 命令来解释。例如,在 Linux 上,perror 35返回OS error code 35: Resource deadlock avoided. 我没有方便测试的 OSX 系统,但从这里开始:

http://www.opensource.apple.com/source/xnu/xnu-1456.1.26/bsd/sys/errno.h

http://www.opensource.apple.com/source/xnu/xnu-1456.1.26/bsd/sys/errno.h

I gather that error 35 is "Resource temporarily unavailable", meaning that some other process (possibly another instance of mysqld?) has already locked the file.

我认为错误 35 是“资源暂时不可用”,这意味着其他一些进程(可能是 mysqld 的另一个实例?)已经锁定了该文件。

To debug, first I would check if there is another MySQL process running by chance (looks like you already have), and if not, reboot for good measure to make sure there are no strange stale file locks, and then try again.

为了调试,首先我会检查是否有另一个 MySQL 进程偶然运行(看起来你已经有了),如果没有,重新启动以确保没有奇怪的陈旧文件锁,然后再试一次。

Somebody has run into this error before, and found a solution:

之前有人遇到过这个错误,并找到了解决方案:

mysql_install_db, error: 35, on a Mac OS X 10.9.1

mysql_install_db,错误:35,在 Mac OS X 10.9.1 上

回答by Nico Prat

Just had this issue with MAMP Pro. Couldn't stop or start MySQL. Typed ps aux | grep mysql, then kill [process id]for each line. Then I could successfully launch MySQL again from MAMP Pro.

MAMP Pro 刚遇到这个问题。无法停止或启动 MySQL。键入ps aux | grep mysql,然后kill [process id]针对每一行。然后我可以再次从 MAMP Pro 成功启动 MySQL。

回答by Sean

I had a similar issue after updating MAMP from 4.x to 5.x

将 MAMP 从 4.x 更新到 5.x 后,我遇到了类似的问题

Unfortunately the only way that I could manage to resolve this was by manually removing all of my database files (moving them into another directory) then starting MySQL via MAMP; this seemed to work.

不幸的是,我能够设法解决这个问题的唯一方法是手动删除我的所有数据库文件(将它们移动到另一个目录中),然后通过 MAMP 启动 MySQL;这似乎有效。

The files in question (for me) were in:

有问题的文件(对我来说)在:

/Library/Application Support/appsolute/MAMP PRO/db/mysql57

/Library/Application Support/appsolute/MAMP PRO/db/mysql57

All of the files in this directory (except the mysqldirectory) need moving somewhere else. I was then able to start MySQL.

此目录中的所有文件(目录除外mysql)都需要移动到其他地方。然后我就可以启动 MySQL。

I realise this isn't a very useful answer for most situations, but if this is a local development environment (like MAMP, as in my case) then I think losing the local databases is probably acceptable.

我意识到这在大多数情况下不是一个非常有用的答案,但如果这是本地开发环境(如 MAMP,就我而言),那么我认为丢失本地数据库可能是可以接受的。