问题
My MySQL server didn't start. When I check error.log file I found this. Can you please suggest me what to do?
151113 6:59:53 [Warning] Using unique option prefix myisam-recover instead of myisam-recover-options is deprecated and will be removed in a future release. Please use the full name instead.
151113 6:59:53 [Note] Plugin 'FEDERATED' is disabled.
151113 6:59:53 InnoDB: The InnoDB memory heap is disabled
151113 6:59:53 InnoDB: Mutexes and rw_locks use GCC atomic builtins
151113 6:59:53 InnoDB: Compressed tables use zlib 1.2.3.4
151113 6:59:53 InnoDB: Initializing buffer pool, size = 128.0M
151113 6:59:53 InnoDB: Completed initialization of buffer pool
InnoDB: Error: checksum mismatch in data file ./ibdata1
151113 6:59:53 InnoDB: Could not open or create data files.
151113 6:59:53 InnoDB: If you tried to add new data files, and it failed here,
151113 6:59:53 InnoDB: you should now edit innodb_data_file_path in my.cnf back
151113 6:59:53 InnoDB: to what it was, and remove the new ibdata files InnoDB created
151113 6:59:53 InnoDB: in this failed attempt. InnoDB only wrote those files full of
151113 6:59:53 InnoDB: zeros, but did not yet use them in any way. But be careful: do not
151113 6:59:53 InnoDB: remove old data files which contain your precious data!
151113 6:59:53 [ERROR] Plugin 'InnoDB' init function returned error.
151113 6:59:53 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
151113 6:59:53 [ERROR] Unknown/unsupported storage engine: InnoDB
151113 6:59:53 [ERROR] Aborting
151113 6:59:53 [Note] /usr/sbin/mysqld: Shutdown complete
回答1:
I've just had this, initially presenting itself as a "mysql respawning too fast" error in the dmesg
logs.
From reading elsewhere I traced it down to what you found, and I think worked out that this points to some kind of corruption in InnoDB's metadata files. InnoDB does things like ensuring transaction/rollback integrity and primary-foreign key integrity. That's what the "checksum mismatch" error is warning you of.
You don't say how you're starting mysqld, but maybe you're using some variant on either /etc/init.d/mysqld start
or service mysqld start
. Run the daemon explicitly as a command instead:
sudo /usr/sbin/mysqld --innodb_force_recovery 0
and, as long as you know why you're doing it, gradually increment the zero value of --innodb_force_recovery
until the process starts.
Warning: The innodb_force_recovery parameter determines just how seriously mysqld will try to "force-fix" the checksum error in the InnoDB storage. So you can make the problem worse, or need later index rebuilding, if you force-fix with a high number here, because InnoDB will do more and more drastic things to try to fix itself.
Every time you fail to restart mysqld
with a particular number e.g. 2
, you should search for the error messages you get before you increment it to 3
so you can be sure you're doing the right thing. I'm not an expert on every error you might get, so I can't provide feedback for every exceptional condition: all I'm saying is, use --innodb_force_recovery
with care!
来源:https://stackoverflow.com/questions/33706106/mysql-innodb-stop-working-on-linode-server