There is a nice tool for this which also replaces the URLs automatically - the way how it does is also recommended by WordPress Codex.
Tool discussion:
Codex page (mentions database search+replace):
https://codex.wordpress.org/Changing_The_Site_URL
WP CLI (used by the tool mentioned above):
http://wp-cli.org/commands/search-replace/