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
- Log in to your old WordPress site's dashboard.
- Go to Tools > Export.
- Choose the WordPress export option.
- Select the All content option.
- 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
- Log in to your hosting control panel (e.g., cPanel).
- Go to Databases > MySQL Databases.
- Create a new database and note down the database name, username, and password.
Step 3: Import the old database into the new database
- Log in to your hosting control panel (e.g., cPanel).
- Go to Databases > phpMyAdmin.
- Select the new database you created in Step 2.
- Click Import.
- Choose the
.sql
file you exported in Step 1. - Click Go to import the database.
Step 4: Update the WordPress configuration
- Log in to the new WordPress site's dashboard.
- Go to Settings > General.
- Update the Database Name, Username, and Password fields with the new database credentials.
- Update the Table Prefix field (if necessary).
Step 5: Update the WordPress configuration files
- Open the
wp-config.php
file in a text editor (e.g., Notepad++). - Update the
DB_NAME
,DB_USER
,DB_PASSWORD
, andDB_HOST
constants with the new database credentials. - Save the changes.
Step 6: Update the WordPress site URL
- Go to Settings > General.
- Update the WordPress Address and Site Address fields with the new site URL.
Step 7: Update any theme or plugin settings
- Review any theme or plugin settings that may have been affected by the database migration.
- Update any settings as necessary.
That's it! Your new WordPress install should now be connected to the old database.