When restarting the PSA service or browsing the Plesk panel, the following error is occur.
Table ‘psa.sessions’ doesn’t exist
To resolve the above error refer to the following steps but make sure that you have logged in to the shell as a root user.
cd /var/lib/psa/dumps
Now check the available psa database backup files.
[root@myroot dumps]# ll | grep mysql.daily.dump
-rw——- 1 root root 460665 Nov 25 03:54 mysql.daily.dump.0.gz
-rw——- 1 root root 455787 Nov 24 03:44 mysql.daily.dump.1.gz
-rw——- 1 root root 455382 Nov 23 03:55 mysql.daily.dump.2.gz
As per above command result. the three backup files are present.
You can first try to generate the existing PSA database backup.
[root@myroot dumps]# mysqldump –opt -uadmin -p`cat /etc/psa/.psa.shadow` psa > psa_ori.sql
mysqldump: Got error: 1146: Table ‘psa.siteapppackages_apscategories’ doesn’t exist when using LOCK TABLES
The mysqldump also not allowing to take backup, no issue simply copy the whole /var/lib/mysql/psa directory to /var/lib/mysql/psa-back.
[root@myroot dumps]#cp -p /var/lib/mysql/psa /var/lib/mysql/psa-back -R
Now try to restore the latest backup file.
[root@myroot dumps]# gunzip mysql.daily.dump.1.gz
[root@myroot dumps]# mv mysql.daily.dump.1 mysql.daily.dump
[root@myroot dumps]#mysql -f -uadmin -p`cat /etc/psa/.psa.shadow` < /var/lib/psa/dumps/mysql.daily.dump
It will restore the backup file but some time the following error is occur.
[root@myroot dumps]# mysql -f -uadmin -p`cat /etc/psa/.psa.shadow` < /var/lib/psa/dumps/mysql.daily.dump
ERROR 1005 (HY000) at line 3636: Can’t create table ‘psa.sessions’ (errno: -1)
ERROR 1146 (42S02) at line 3654: Table ‘psa.sessions’ doesn’t exist
ERROR 1146 (42S02) at line 3655: Table ‘psa.sessions’ doesn’t exist
ERROR 1146 (42S02) at line 3656: Table ‘psa.sessions’ doesn’t exist
ERROR 1146 (42S02) at line 3657: Table ‘psa.sessions’ doesn’t exist
To resolve the above error simply follow the steps.
[root@myroot dumps]# mysql -u admin -p$(cat /etc/psa/.psa.shadow)
It will provide you mysql command prompt.
mysql> use psa;
mysql> show databases;
Now run the query given on the following URL from command prompt.
Create PS-SESSION table mysql database query
once above query completed, simply restore the psa database backup
mysql -f -uadmin -p`cat /etc/psa/.psa.shadow` < /var/lib/psa/dumps/mysql.daily.dump
If the latest psa backup file is corrupted then refer to the following steps.
Check the old psa database file and restore it.
zcat /var/lib/psa/dumps/mysql.daily.dump.2.gz | mysql -uadmin -p`cat /etc/psa/.psa.shadow` psa