我通过查杀进程id来停止mysqld,然后还删除了mysqld.sock文件。 现在,mysqld没有启动。
我知道有一些数据损坏。但现在我需要启动MySQL而不重新安装它。
以下是生成的日志。
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. 140107 8:27:43 InnoDB: Unable to open the first data file InnoDB: Error in opening ./ibdata1 140107 8:27:43 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/en/operating-system-error-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! 140107 8:27:43 [ERROR] Plugin 'InnoDB' init function returned error. 140107 8:27:43 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed. 140107 8:27:43 [ERROR] /usr/libexec/mysqld: unknown option '--ndbcluster' 140107 8:27:43 [ERROR] Aborting 140107 8:27:43 [Note] /usr/libexec/mysqld: Shutdown complete 140107 08:27:43 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended
答案 0 :(得分:15)
您需要恢复innodb数据文件。
# cd /var/lib/mysql
# mkdir bak
# mv ibdata1 bak/
# mv ib_logfile* bak/
# cp -a bak/ibdata1 ibdata1
# cp -a bak/ib_logfile* .
# rm -rf bak
# service mysqld restart
参考:http://notesonit.blogspot.hk/2013/05/innodb-unable-to-lock-ibdata1-error-11.html
答案 1 :(得分:0)
哇。我有这个问题,因为那是一个清晨,我的大脑不起作用。我正在做以下事情:
sudo mysqld -u root -p
当我应该这样做的时候:
sudo mysql -u root -p
希望这可以帮助像我这样早安的人。哈哈