At times you may find yourself in a situation where you need to change the database information that your Wordpress installation is connected to. The quickest example that I can think of is if you move your website to a new web host and then the database prefix for the name and and user usually must be changed.
The first thing that you should do is obtain your database name, user, password, and host (though that usually stays at localhost). Locate and open the wpconfig file (It should be in the root web folder often named /public_html). The wpconfig file is what was created using the settings that you entered when you first installed this WordPress installation. It is a file that the site uses to hold the configuration information for the WordPress application.
Edit the wpconfig file by changing the referenced database information that is the second field in the define brackets. Save your file and reupload. You should notice that the website is now connecting to the proper database. Happy Blogging!