Troubleshooting WordPress

See also

WordPress is a PHP-based application. Please see PHP and Static Files, CGI Scripts, and PHP Pages for additional documentation.

Error: Error establishing a database connection

When WordPress is unable to connect to the MySQL database, all WordPress pages show this error: Error establishing a database connection. One common cause of this error is misconfigured database settings.

To verify your WordPress application’s database settings:

  1. Verify the settings in wp-config.php.

    1. Open ~/webapps/app/wp-config.php in a text editor, where app is the name of the WordPress application.

    2. Verify the database name. The line starting define('DB_NAME', ends with 'app_wp'); where app is the name of the application. If this is not set correctly, edit the line to contain the correct value.

      Note

      Some WordPress applications created before 2013 may use a database name like username_app_wp, where username is your account name.

    3. Verify the database user. The line starting define('DB_USER', should end with 'app_wp');. If this is not set correctly, edit the line to contain the correct value.

      Note

      Some WordPress applications created before 2013 may use a database user like username_app_wp, where username is your account name.

    4. Verify the database password. The line starting define('DB_PASSWORD', should end with 'pass');, where pass is the password for the WordPress application’s MySQL database. If this is not set correctly, edit the line to contain the correct value.

      If you do not already know it, you can find the correct database password using the WebFaction control panel:

      1. Log in to the WebFaction control panel.
      2. Click Domains / websites ‣ Applications. The list of applications appears.
      3. Click the name of your WordPress application in the list. The application’s details appear. The database password is in Extra info section.
    5. Verify the database hostname. The line starting define('DB_HOST', should end with 'localhost');. If this is not set correctly, edit the line to contain the correct value.

    6. Save and close the file.

  2. Verify the database user’s password is set correctly.

    1. Log in to the control panel.

    2. Click Domains / websites ‣ Applications. The list of applications appears.

    3. Click the name of your WordPress application in the list. The application’s details appear.

    4. Make a note of the password in the Extra info section.

    5. Click Databases ‣ Database Users. The list of database users appears.

    6. In the list, click the user named app_wp.

      Note

      Some WordPress applications created before 2013 may use a database user like username_app_wp, where username is your account name.

      The user’s details appear.

    7. In the Password field, click Change. A Password field and Confirm password field appear.

    8. In the Password field, enter the password from the Extra info field you made a note of previously.

    9. In the Confirm Password field, reenter the password.

    10. Click the Save button. The password is changed and a confirmation message appears.

Your WordPress application’s database should now be configured correctly.