InnoDB Data Recovery – How to Recover from Datafile Corruption

corruptiondata-recoveryinnodb

First of all, my MySQL DB and Linux skills are not so good. I spent several days searching for a solution and tried several approaches. The following approach is the one I came furthest with.

My SD card, on which my MariaDB was installed, is corrupt. However, I was able to recover the /var/lib/mysql directory.

I set up a new Ubuntu installation and a clean MySQL database.
After I copied the recovered database directories into the new folder (without ibdata) and restarted the database, I could see the tables but got the error '1146 table doesn't exist'.

Then I also copied the file ibdata and changed the permissions (chmod, chown, chgrp). But after that I can't start the MySQL service anymore. I get the following error:

[Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().

[ERROR] InnoDB: Cannot create log files in read-only mode

[ERROR] InnoDB: Plugin initialization aborted with error Read only transaction

[ERROR] Plugin 'InnoDB' init function returned error.

[ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.

[ERROR] Failed to initialize builtin plugins.

[ERROR] Aborting

I tried innodb_force_recovery 0-6 without success.

Does anyone have a hint for me what the error means and how I can recover my database?

Best Answer

It seems your MySQL directory is in read-only mode: [ERROR] InnoDB: Cannot create log files in read-only mode. Be sure to have write permission for the directory and the files inside it.

That said, if your SDcard failed, chances are that data itself are corrupted beyond repair.

Related Topic