How to update WordPress site URL in the database

If you site moves, or you are trying to create a development site, you will have to update the site URL in the database. The easiest way do to that is to run a WLCLI command from the command line:

wp search-replace https://myoldurl.com http://mynewurl.com

Unfortunately, sometimes you might not have access to WPCLI or WPCLI errors out. In this case you can run this command on the database. Be sure to back up your database and update all the instances in the url in this example before executing it.

UPDATE wp_options SET option_value = replace(option_value, 'https://myoldurl.com', 'http://mynewurl.com') WHERE option_name = 'home' OR option_name = 'siteurl';
UPDATE wp_posts SET guid = replace(guid, 'https://myoldurl.com','http://mynewurl.com');
UPDATE wp_posts SET post_content = replace(post_content, 'https://myoldurl.com', 'http://mynewurl.com'); 
UPDATE wp_postmeta SET meta_value = replace(meta_value,'https://myoldurl.com','http://mynewurl.com');

Just in case you might also want to run the command for http://myoldurl.com to make sure all your content is covered by SSL.