Symptoms
-
Unable to restore the
psa
database:# ERROR 1813 (HY000) at line 151: Tablespace for table 'psa.APSLicenses' exists. Please DISCARD the tablespace before IMPORT
-
Unable to create a dump of the
psa
database:# mysqldump: Got error: 1932: "Table 'psa.APSLicenses' doesn't exist in engine" when using LOCK TABLES
Cause
The psa
database is corrupted.
Resolution
-
Connect to the Plesk server via SSH.
-
Create a backup of the files stored in
/var/lib/mysql/psa
:# mkdir /root/varlibmysqlpsa/
# cp -a /var/lib/mysql/psa/* /root/varlibmysqlpsa
-
Remove the files:
# rm -rf /var/lib/mysql/psa/*
-
Remove the
psa
database:# plesk db "DROP DATABASE psa"
-
Connect to MySQL and create an empty
psa
database:# MYSQL_PWD=$(cat /etc/psa/.psa.shadow) mysql -uadmin
MariaDB [(none)]> create database psa;
Query OK, 1 row affected (0.002 sec)
MariaDB [(none)]> quit
-
Restore the
psa
database from the latest daily backup:# cd /var/lib/psa/dumps
# zcat mysql.daily.dump.0.gz | sed -n '/-- Current Database: `psa`/,/-- Current Database:*/p' | MYSQL_PWD=`cat /etc/psa/.psa.shadow` mysql -uadmin --default-character-set=utf8