Skip to content

Updating WordPress database configuration settings

If your WordPress site shows the error “Error establishing a database connection”, it usually means the database configuration in wp-config.php does not match your actual database settings. On ruachost.com, you can fix this by updating the configuration file with the correct credentials.

  • Resolve connection errors after migrations or imports.
  • Ensure WordPress can communicate with the correct database.
  • Restore site functionality when credentials change.

Step 1: Determine Correct Database Settings

Section titled “Step 1: Determine Correct Database Settings”
  1. Log in to cPanel from your ruachost.com hosting account.

  2. Go to Databases → phpMyAdmin.

  3. In the left panel, locate your WordPress database name.

    • Typically formatted as username_wpXXX.
  4. Click the database → Note the table prefix (usually wp_).

  5. Return to Databases → MySQL Databases.

  6. Note the database username associated with your WordPress database.

  7. Reset the database user’s password if you don’t know it.

  1. In cPanel, go to Files → File Manager.

  2. Navigate to your WordPress installation directory (usually public_html).

  3. Locate and edit the wp-config.php file.

  4. Update the following lines with your correct database details:

    define('DB_NAME', 'username_wp123'); // Database name
    define('DB_USER', 'username_wpuser'); // Database username
    define('DB_PASSWORD', 'your_password'); // Database password
    define('DB_HOST', 'localhost'); // Database host
    $table_prefix = 'wp_'; // Table prefix
  5. Save changes.

  6. Visit your WordPress site → It should now load correctly.

  • Always back up your site before editing configuration files.
  • Do not use weak passwords for database users.
  • If your hosting environment uses a remote database server, replace localhost with the correct hostname.
  • Ensure the $table_prefix matches the prefix used in your database tables.