无法停止mysql(无法锁定./ibdata1,错误:11)

时间:2013-01-09 02:33:36

标签: mysql

两天以来,我无法使用我的root帐户连接到mysql。 我可以使用其他帐户登录。

我首先认为我的服务器被黑了,而且有人更改了密码。我试着重置它。为此,我不得不使用mysqld_safe,因此停止mysql,我没有做到:

> sudo /etc/init.d/mysql stop
Stopping MySQL database server: mysqld failed!

> mysqld stop
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.
130107 13:48:34  InnoDB: Unable to open the first data file
[...]
InnoDB: Error in opening ./ibdata1
130107 13:48:34  InnoDB: Operating system error number 11 in a file operation.
InnoDB: Error number 11 means 'Resource temporarily unavailable'.
InnoDB: Some operating system error numbers are described at
InnoDB: http://dev.mysql.com/doc/refman/5.1/...ror-codes.html
InnoDB: Could not open or create data files.
InnoDB: If you tried to add new data files, and it failed here,
InnoDB: you should now edit innodb_data_file_path in my.cnf back
InnoDB: to what it was, and remove the new ibdata files InnoDB created
InnoDB: in this failed attempt. InnoDB only wrote those files full of
InnoDB: zeros, but did not yet use them in any way. But be careful: do not
InnoDB: remove old data files which contain your precious data!
130107 13:48:34 [ERROR] Plugin 'InnoDB' init function returned error.
130107 13:48:34 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
mysqld: Too many arguments (first extra is 'stop').

MySQL无法读取ibdata1,因此我检查其权限看起来是否正确:

> ls -l /var/lib/mysql/
-rw-rw---- 1 mysql mysql 18874368 Jan  7 12:39 ibdata1
-rw-rw---- 1 mysql mysql  5242880 Jan  7 13:05 ib_logfile0
-rw-rw---- 1 mysql mysql  5242880 Jan  7 13:05 ib_logfile1

我尝试移动并复制文件explained here,但没有任何成功:

> mv /var/lib/mysql/ibdata1 /var/lib/mysql/ibdata1.bak
> cp -a /var/lib/mysql/ibdata1.bak /var/lib/mysql/ibdata1

这是my.cnf的一部分

user            = mysql
pid-file        = /var/run/mysqld/mysqld.pid
socket          = /var/run/mysqld/mysqld.sock
port            = 3306
basedir         = /usr
datadir         = /var/lib/mysql
tmpdir          = /tmp
LANGUAGE        = /usr/share/mysql/english
skip-external-locking

datadir是正确的。

同样,这是当我尝试获取MySQL状态时会发生的事情:

# sudo /etc/init.d/mysql status
/usr/bin/mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user 'debian-sys-maint'@'localhost' (using password: YES)'

我在this page找到了解决此问题的方法,但我必须以root用户身份登录才能这样做,我不能这样做。我想这两个问题是相关的。

你们中有谁知道如何解决这个问题?因为这个原因,我被封锁了。

非常感谢您阅读此邮件,也许回复此邮件。

度过美好的一天!

0 个答案:

没有答案