hashchen
hashchen

Reputation: 1039

Checking for tables which need an upgrade, are corrupt or were not closed cleanly

I am running mysql on my EC2 and when I tried to do: sudo /etc/init.d/mysql restart I got this:

Here is what is in my /var/log/mysql/error.log

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.
140406  1:47:27  InnoDB: Unable to open the first data file
InnoDB: Error in opening ./ibdata1
140406  1:47:27  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.5/en/operating-system-error-codes.html
140406  1:47:27 InnoDB: Could not open or create data files.
140406  1:47:27 InnoDB: If you tried to add new data files, and it failed here,
140406  1:47:27 InnoDB: you should now edit innodb_data_file_path in my.cnf back
140406  1:47:27 InnoDB: to what it was, and remove the new ibdata files InnoDB created
140406  1:47:27 InnoDB: in this failed attempt. InnoDB only wrote those files full of
140406  1:47:27 InnoDB: zeros, but did not yet use them in any way. But be careful: do not
140406  1:47:27 InnoDB: remove old data files which contain your precious data!
140406  1:47:27 [ERROR] Plugin 'InnoDB' init function returned error.
140406  1:47:27 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
140406  1:47:27 [ERROR] Unknown/unsupported storage engine: InnoDB
140406  1:47:27 [ERROR] Aborting

140406  1:47:27 [Note] /usr/sbin/mysqld: Shutdown complete

140406 01:47:27 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended

Could someone please tell me what is going on?

Thanks

Upvotes: 1

Views: 32848

Answers (2)

cd /var/lib/mysql  
#killall -9 mysqld
#innochecksum -d ibdata1
nano /etc/mysql/my.cnf
[mysqld]
innodb_force_recovery = 4
/etc/init.d/mysql start

Upvotes: 1

Rico
Rico

Reputation: 61621

Looks you have a mysql process running. There's a lock on your ./ibdata1 file. it could be that for some reason your service mysql stop command is not stopping the process as it may not be finding the PID of your mysql server.

Run from the command line:

ps -Af | grep mysql

Get the PID of your mysql process and then simply:

kill -9 <PID of your mysql process>

Upvotes: 4

Related Questions