Symptoms
-
Plesk is not accessible with one of the following error messages in a web-browser:
PLESK_INFO: ERROR: Zend_Db_Statement_Exception: SQLSTATE[42S02]: Base table or view not found: 1146 Table ‘psa.sessioncontexts’ doesn’t exist
ERROR: Zend_Db_Statement_Exception: SQLSTATE[42S02]: Base table or view not found: 1146 Table ‘psa.servicenodes’ doesn’t exist
PLESK_INFO: ERROR: PleskMainDBException
MySQL query failed: Unknown column ‘id’ in ‘field list’
PLESK_INFO: ERROR: PleskExceptionDatabase: DB query failed: SQLSTATE[42S02]: Base table or view not found: 1146 Table ‘psa.sessions’ doesn’t exist, query was: DESCRIBE `sessions`
PLESK_INFO: DB query failed: SQLSTATE[42S02]: Base table or view not found: 1146 Table ‘psa.misc’ doesn’t exist, query was: replace into misc (param, val) values(:param, :val)
Cause
The Plesk ‘psa’ system database is corrupted.
Resolution
Restore the Plesk ‘psa’ system database from the Plesk daily dump.
For Plesk on Linux
-
Connect to the Plesk server via SSH.
-
Switch to the directory with daily dumps:
# cd /var/lib/psa/dumps
-
List all available Plesk daily dumps:
# ls -l mysql.daily*
-rw——- 1 root root 236253 Feb 3 01:51 mysql.daily.dump.0.gz
-rw——- 1 root root 229653 Feb 2 01:48 mysql.daily.dump.1.gz
-rw——- 1 root root 222485 Feb 1 01:56 mysql.daily.dump.2.gz- where
mysql.daily.dump.0.gz
is the most recent daily dump.
- where
-
Restore the ‘psa’ database from the most recent daily dump. In this example, the ‘psa’ database is being restored from
mysql.daily.dump.0.gz
:# 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
Remove tables from /var/lib/mysql/psa if the same set of tables is mentioned in the error all the time
-
Access Plesk.
If Plesk is still not accessible, try to restore the ‘psa’ database from an earlier Plesk daily dump:
# zcat mysql.daily.dump.1.gz | sed -n ‘/– Current Database: `psa`/,/– Current Database:*/p’ | MYSQL_PWD=`cat /etc/psa/.psa.shadow` mysql -uadmin –default-character-set=utf8
For Plesk on Windows Server
-
Connect to the Plesk server via RDP.
-
Switch to the directory with daily dumps:
C:> cd %plesk_dir%MysqlBackup
-
List all available Plesk daily dumps with the ‘psa’ database sorted by date (newest first):
C:> dir psa* /O:-D
Directory of C:Program Files (x86)PleskMySQLBackup
03/29/2019 08:33 PM 502,879 psa-20190329203301.sql
03/28/2019 08:33 PM 468,888 psa-20190328203301.sql
03/27/2019 08:33 PM 468,888 psa-20190327203301.sql -
Restore the ‘psa’ database from the latest available daily dump. In this example, we are restoring the dump from 03/29/2019:
C:> plesk db < psa-20190329203301.sql
-
Access Plesk.