Loading...

Knowledge Base

WordPress: How to Update Database Connection Strings

Your WordPress website must be connected to a database for it to function and be accessible online. This article will guide you through the process of updating the connection strings of your WordPress website if you need to connect it to a different database.

Step 1: Get Your New Database Information

  1. Log in to your Account Manager.
  2. Click Hosting in the left-hand menu.

    Account Hosting Section

  3. Search for the hosting plan where your database is, and then click its Manage button.

    Hosting - Manage

  4. Navigate to your new database.
    1. Click MySQL Management in the left-hand menu.

      MySQL Management

    2. Locate the database you need to manage, then click its Manage link on the right.

      Manage database

    3. Take note of the database name  and username. You may also need to change the password by clicking the Change Password option.
    1. Click Database Manager under Configurations.

      Configurations - Database Manager

    2. Look for your new database and click the database name.

      Database name

    3. Take note of the database name and username. You may also need to change its password if you no longer remember it.

      Database name & username

Step 2: Update Your wp-config.php File

  1. Within your Account Manager, navigate to the Hosting tab.
  2. Search for the hosting plan where your WordPress is being hosted, and then click its Manage button.

    Hosting - Manage

    1. Click File Manager on the left-hand menu.

      File Manager

    2. Click your site's folder (directory). For this example, we'll use the public_html folder.
    1. Take note of your FTP information under the Hosting Information section on the right.

      FTP Information

    2. Launch your FTP client and use your FTP info to connect to your website's File Manager. Visit the FTP: How to Connect Using an FTP Client article for instructions.
    3. Navigate to your site's folder (directory). For this example, we'll use the public_html folder.
  3. Within the public_html (your site's folder), locate the wp-config.php file, click on the three-dot menu on the right, and select Edit.

    wp-config.php file - Edit

  4. Locate the following lines of code:
    // ** MySQL settings - You can get this info from your web host ** //
    /** The name of the database for WordPress */
    define('DB_NAME', 'database_name');
    
    /** MySQL database username */
    define('DB_USER', 'database_username');
    
    /** MySQL database password */
    define('DB_PASSWORD', 'DatabasePassword');
    
    /** MySQL hostname */ 
    define('DB_HOST', 'localhost');
    
  5. Change the values for the database name, username, and password.
  6. Click the Save button to save your changes.
  7. Relaunch and check your website in a browser.

Loading...