WordPress uses serialized arrays to store some data (like widgets), so you can’t simply do a find/replace. If you did and the URLs were of a different length, the serialized array would break and you’d lose content.
Download this database search and replace script. Upload the folder to the top level of your server (same directory as wp-config.php), then open it in a browser. It will ask you what URLs to find/replace, and what tables it will affect. You can even do a dry run to test it before making any changes.
See the plugin’s website for more information.
Join Our Team at CultivateWP
We design and build high-performance custom WordPress themes for market leading web publishers. We're looking for designers & developers to join our team.