Articles in this section

An Email Notification from WP Toolkit is received: Failed to reset cache for the instance: Error establishing a database connection.

Applicable to:

  • Plesk for Linux

Symptoms

  • The following notification is received via email regarding the WordPress instance example.com:

    PLESK_ERROR: Failed to reset cache for the instance: Error establishing a database connection. This either means that the username and password information in your `wp-config.php` file is incorrect or we can't contact the database server at ``. This could mean your host's database server is down.

  • The same error is reproduced while trying to scan the instance example.com via WP Toolkit.

  • The WordPress website example.com is up and running.

Cause

Unsupported/customized database connection string set in the wp-config.php file prevent WP Toolkit from reading the data.
Every WordPress database connection string must be in the form of PHP define. Other methods like arrays and variables, are not supported.

Resolution

  1. Log into Plesk.

  2. Go to Domains > example.com > File Manager

  3. Open the wp-config.php file.

  4. Make sure the Database details such as DB_NAME, DB_HOST and user credentials are set with the default method of PHP define. e.g:

    CONFIG_TEXT: define( 'DB_NAME', 'wp_dbnameexample' );
    define( 'DB_USER', 'wp_userexample' );
    define( 'DB_PASSWORD', 'pa$$w0rdExampl3!' );
    define( 'DB_HOST', 'localhost:3306' );
    define( 'DB_CHARSET', 'utf8' );
    define( 'DB_COLLATE', '' );

Correct the database connection details from SSH
  1. Connect to the server via SSH;

  2. Navigate to the WordPress directory usually at the domain root path:

    # cd /var/www/vhost/example.com/httpdocs

  3. Edit the WordPress wp-config.php file. Vi editor can be used for this:

    # vi wp-config.php

  4. Make sure the Database details such as DB_NAME, DB_HOST and user credentials are set with the default method of PHP define. e.g:

    CONFIG_TEXT: define( 'DB_NAME', 'wp_dbnameexample' );
    define( 'DB_USER', 'wp_userexample' );
    define( 'DB_PASSWORD', 'pa$$w0rdExampl3!' );
    define( 'DB_HOST', 'localhost:3306' );
    define( 'DB_CHARSET', 'utf8' );
    define( 'DB_COLLATE', '' );

Was this article helpful?

Comments

0 comments

Please sign in to leave a comment.