Articles in this section

WordPress site does not work: Error establishing a database connection

Plesk for Linux kb: technical

Applicable to:

  • Plesk for Linux

Symptoms

  • Opening a WP website example.com in web browser, shows the following error:

    Error establishing a database connection

  • Steps from this article do not solve the issue

  • It is possible connecting to Database via CLI:

    # mysql -h localhost -u db_username -p db_name
    Enter password:
    MariaDB [db_name]>

  • Site resolves to the same IP addres set in Plesk > Tools & Settings > IP addresses

Cause

The database of this website is clearly corrupted, because the siteurl and home SQL records are missing from the wp_options table of its database.

Resolution

Restore the affected website database from a recent backup in which the wp_options table of this database is not corrupted.

If you have domain backups configured in Plesk for this domain, you may use the steps in the following article in order to restore the website database:

How to restore Subscription or Domain contents from a Plesk backup? - section Restoring Domain content from a Subscription Plesk backup

Alternatively, you would need to insert the missing records in wp_options table of the website database manually on your end. The database management tools in Plesk will help you achieve that.

Was this article helpful?

Comments

0 comments

Please sign in to leave a comment.