If you have to migrate Magento database from one server to another, or from your local working station to server (etc.), you sure noticed that Magento store informations about base urls in database, so you have to change this data. To fix this you need migrate the database to new server, and then through PHPMyAdmin, or mysql console submit this commands to change new base url and base secure url.
UPDATE core_config_data SET `value` = 'http://www.newdomain.com/' WHERE `path` in ('web/unsecure/base_url', 'web/secure/base_url');
Dont forget the closing /.












