Error establishing a database connection when trying to open database-based website

Created:

2016-11-16 13:24:08 UTC

Modified:

2017-08-08 13:40:13 UTC

0

Was this article helpful?


Have more questions?

Submit a request

Error establishing a database connection when trying to open database-based website

Applicable to:

  • Plesk 12.5 for Linux

Symptoms

Error establishing a database connection is shown when try to open database-based website.

Cause

Database user is missing in mysql.user table.

Resolution

  1. Check if user exists in mysql daily dumps in var/lib/psa/dumps folder. Restore dump if necessary.

  2. If user does not exist, try to re-create this user using plesk repair mysql utility.

  3. If plesk repair mysql does not work, create user manually using the following query:

    GRANT ALL PRIVILEGES ON <db_name>.* TO <db_user>@"%" IDENTIFIED BY '<db_password>' WITH GRANT OPTION;

    Values <db_name>, <db_user>, <db_password> can be found in website database configuration file.

For WordPress installations <wordpress_installation_path>/wp-config.php .
For Magento installations <magento_installation_path>/app/etc/local.xml .

Have more questions? Submit a request
Please sign in to leave a comment.