I have gotten myself into WAY too much trouble after migrating other people's Wordpress site from one server to another. This is not Wordpress specific, other CMSs use static URL's in their database rather than keeping it in a CONFIG file somewhere that you change when you change the database login info so that these problems do NOT happen, but they don't so this is what you need to change if you notice that when you log into the admin side of things and it is the old site. (Or you break the old, live site, even if you don't have access to their live DB or passwords)
I got this from a WP tutorial site.
Step 5: Changing the Site URL
Now you need to change the site URL, so you can setup your live WordPress site. In your phpMyAdmin, look for the wp_options table in your database that we just imported in step 4. If you
changed your database prefix, then instead of wp_options it might be {prefix}_options.
Click on the browse button next to wp_options or the link that you see in the sidebar to open the page with a list of fields within the wp_options table. See screenshot below:
Under the field options_name, you need to look for siteurl. Click the Edit Field icon which can be found at the far left at the beginning of the row.
When you click the edit field, an edit field window will appear. In the input box for option_value, you will see the URL of your local install probably something like:http://localhost/test
. Carefully insert your new site url in this field, for example:http://www.wpbeginner.com
Save the field by clicking the Go button.
Next, you need to replicate this step for the option name: home. The wp_options page can be a few pages long, so simply find the home tab. Usually it is on the second page which you can navigate to by clicking on the pagination arrows in phpMyAdmin.
Update the home url to be the same as your siteurl.