Connect new wordpress install to old database

A common task!

To connect a new WordPress install to an old database, you'll need to follow these steps:

Step 1: Export the old database

  1. Log in to your old WordPress site's dashboard.
  2. Go to Tools > Export.
  3. Choose the WordPress export option.
  4. Select the All content option.
  5. Click Download Export File to download the database dump file (usually in .sql format).

Step 2: Create a new database for the new WordPress install

  1. Log in to your hosting control panel (e.g., cPanel).
  2. Go to Databases > MySQL Databases.
  3. Create a new database and note down the database name, username, and password.

Step 3: Import the old database into the new database

  1. Log in to your hosting control panel (e.g., cPanel).
  2. Go to Databases > phpMyAdmin.
  3. Select the new database you created in Step 2.
  4. Click Import.
  5. Choose the .sql file you exported in Step 1.
  6. Click Go to import the database.

Step 4: Update the WordPress configuration

  1. Log in to the new WordPress site's dashboard.
  2. Go to Settings > General.
  3. Update the Database Name, Username, and Password fields with the new database credentials.
  4. Update the Table Prefix field (if necessary).

Step 5: Update the WordPress configuration files

  1. Open the wp-config.php file in a text editor (e.g., Notepad++).
  2. Update the DB_NAME, DB_USER, DB_PASSWORD, and DB_HOST constants with the new database credentials.
  3. Save the changes.

Step 6: Update the WordPress site URL

  1. Go to Settings > General.
  2. Update the WordPress Address and Site Address fields with the new site URL.

Step 7: Update any theme or plugin settings

  1. Review any theme or plugin settings that may have been affected by the database migration.
  2. Update any settings as necessary.

That's it! Your new WordPress install should now be connected to the old database.