/ibdata1 can't be opened in read-write mode

I am trying to restore a xtra backup into new machine using xtrabackup --copy-back option. After successfully restoring the backup when i initiate the instance, it throws the following exceptions. Apparently it looks that its permissions issue, but its actually not permission issue. How can i resolve this issue ?

[ERROR] InnoDB: ./ibdata1 can’t be opened in read-write mode
[ERROR] InnoDB: The system tablespace must be writable!
[ERROR] Plugin ‘InnoDB’ init function returned error.
[ERROR] Plugin ‘InnoDB’ registration as a STORAGE ENGINE failed.
[ERROR] Unknown/unsupported storage engine: InnoDB
[ERROR] Aborting

1 Like

The error means permission issue.
Make sure that you ran:
chown -r mysql:mysql /var/lib/mysql ( or your datadir path here )

Also check if SElinux or apparmor is correctly allowing mysql to access your datadir

2 Likes

I am executing chown -R mysql:mysql /data-dir-path before starting the instance but NO success.

How to check “Also check if SElinux or apparmor is correctly allowing mysql to access your datadir” ?

1 Like

Hi @aanees -
On SElinux systems, you can run setenforce 0 and then try again to see if mysqld will start up
For Apparmor you can follow these instructions on Ubuntu https://linuxconfig.org/how-to-disable-apparmor-on-ubuntu-20-04-focal-fossa-linux

If MySQL starts then you’ll need to either keep the security feature disabled, or edit the configuration to permit reads from /data-dir-path you can follow the instructions from this post https://blogs.oracle.com/mysql/apparmor-and-mysql-v2

2 Likes

Thanks guys. It works!

After disabling SELinux MySQL instance is up and running.

1 Like