As a freelancer, I have to transfer websites from my test server to the live servers all the time. In these situations, both the server and the domain name are changing, so there might be quite some hassle in finding all those links in the database and replace them.
However, there’s a very simple trick you can do:
Before copying the website files and the database, just go to Dashboard -> Settings -> General and change the WordPress Address and the Site Address to the new domain name.
Hit the save button and wait. Most likely, a not-found page will show up, with bad styling. Don’t worry about it.
Now you can just copy the website’s files and database, upload them to the new server and hit then connect the database properly in the wp-config.php file.
That’s it. All that’s left is to replace the hard-coded links inside your pages. But the links in the menus, the links of the media files, of the categories, archives, etc… they’re all going to be changed automatically.