I recently decided to create a test/development instance of a WordPress site that I run. In part of doing this I had to deal with how to backup one MySQL database and restore it to another database. After that was done, and I copied over the content files, I had to tell WordPress where to find the new database and how to connect to it.
How is this done? Find the wp-config.php file that’s located in your WordPress site. Open that file in your favorite text editor (like WebMatrix) and look for the database connection settings, which will be near the top of the file (after a large block of comments). It should look like…
// ** MySQL settings - You can get this info from your web host ** // /** The name of the database for WordPress */ define('DB_NAME', '*NameOfTheDatabase*'); /** MySQL database username */ define('DB_USER', '*NameOfTheDatabaseUser*'); /** MySQL database password */ define('DB_PASSWORD', '*TheDatabaseUserPassword*'); /** MySQL hostname */ define('DB_HOST', '*TheNameOfTheDatabaseServer*');
The sections are self-explanatory so just go through one line at a time and edit the fields to match the database server name, database name, username for the connection, and the password for the database user. Save the file and you should be good to load up your new WordPress site now.