Cannot open Plesk: ERROR: PleskFatalException Unable to connect to database: Unknown database psa

Posted: December 18, 2016 in Plesk

Plesk is not accessible. The error below is shown:

ERROR: PleskFatalException
Unable to connect to database: Unknown database 'psa'

0: common_func.php3:150
    psaerror(string 'Unable to connect to database: Unknown database 'psa'')
1: auth.php3:111

Cause

The psa database does not exist.

Resolution

  1. Log in to MySQL and check if the psa database exists:
    # MYSQL_PWD=`cat /etc/psa/.psa.shadow` mysql -u admin
    
    mysql> show databases like 'psa';
    Empty set (0.00 sec)
    

    So, at this point, you need to restore the database from the latest available backup on the server.

  2. Check if backups exist in the dump directory:
    ~# grep dump /etc/psa/psa.conf
    DUMP_D /var/lib/psa/dumps
    
    ~# ls -la  # ls -lt /var/lib/psa/dumps/mysql.daily.dump*
    -rw------- 1 root root 239658 Dec 10 03:37 /var/lib/psa/dumps/mysql.daily.dump.0.gz
    -rw------- 1 root root 241242 Dec  9 03:37 /var/lib/psa/dumps/mysql.daily.dump.1.gz
    -rw------- 1 root root 241376 Dec  8 03:37 /var/lib/psa/dumps/mysql.daily.dump.2.gz
    -rw------- 1 root root 241887 Dec  7 03:38 /var/lib/psa/dumps/mysql.daily.dump.3.gz
    -rw------- 1 root root 237143 Dec  6 03:38 /var/lib/psa/dumps/mysql.daily.dump.4.gz
    -rw------- 1 root root 233966 Dec  5 03:36 /var/lib/psa/dumps/mysql.daily.dump.5.gz
    -rw------- 1 root root 233495 Dec  4 03:38 /var/lib/psa/dumps/mysql.daily.dump.6.gz
    -rw------- 1 root root 232856 Dec  3 03:36 /var/lib/psa/dumps/mysql.daily.dump.7.gz
    -rw------- 1 root root 232710 Dec  2 03:36 /var/lib/psa/dumps/mysql.daily.dump.8.gz
    
  3. Restore the latest daily dump (from Dec. 10 in this case) using the commands below:
    # gunzip /var/lib/psa/dumps/mysql.daily.dump.0.gz 
    # MYSQL_PWD=`cat /etc/psa/.psa.shadow` mysql -u admin  -e "create database psa"
    # MYSQL_PWD=`cat /etc/psa/.psa.shadow` mysql -u admin psa < /var/lib/psa/dumps/mysql.daily.dump.0
 
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s