Symptoms
MySQL/MariaDB fails to start with the following error message in the logfile:
- on Linux:
/var/log/mariadb/mariadb.log
or/var/log/mysql/error.log
- on Windows Server:
%plesk_dir%Databases
MySQLdataSERVERNAME.err
[ERROR] InnoDB: Attempted to open a previously opened tablespace. Previous tablespace db_name/db_table uses space ID: 132 at filepath: ./db_name/db_table.ibd.
InnoDB: Error: could not open single-table tablespace file some_table.ibd.
Cause
Client database is corrupted.
Resolution
-
Connect to the server via SSH.
-
Open the
/etc/my.cnf
file in a text editor. In this example we use the vi editor:-
on CentOS/RHEL-based distributions
# vi /etc/my.cnf
-
on Debian/Ubuntu-based distributions
# vi /etc/mysql/my.cnf
-
-
Add the following line under the [mysqld] section:
[mysqld]
innodb_force_recovery = 1 - Save the changes and close the file.
-
Start MySQL/MariaDB service. The command depends on MySQL version and OS:
# service mariadb start
# service mysql start
# service mysqld start
-
Remove the "innodb_force_recovery = 1" line from the
/etc/my.cnf
file. -
Restart MySQL/MariaDB service. The command depends on MySQL version and OS:
# service mariadb restart
# service mysql restart
# service mysqld restart
Note: If the steps above did not help, fix the database using the InnoDB force recovery.
-
Connect to the server via RDP.
Open the
%plesk_dir%DatabasesMySQLmy.ini
file in a text editor. -
Add the following line under the [mysqld] section:
[mysqld]
innodb_force_recovery = 1 -
Save the changes and close the file.
-
Open services.msc and start MySQL/MariaDB service.
-
Remove "innodb_force_recovery = 1" from
%plesk_dir%DatabasesMySQLmy.ini
-
Restart MySQL/MariaDB service.
- Restore the corrupted database from a valid backup.