Domain change via sql queries in phpmyadmin

**!!! It is recommended to create a backup copy of the database before proceeding

Go into phpmyadmin → on the left side click on your database → SQL tab and make 3 sql queries

UPDATE wp_options SET option_value = REPLACE(option_value, 'http://old_domain.com', 'http://new_domain.com') WHERE  
option_name = 'home' OR option_name = 'siteurl';  
UPDATE wp_posts SET guid = REPLACE(guid, 'http://old_domain.com', 'http://new_domain.com');  
UPDATE wp_posts SET post_content = REPLACE(post_content, 'http://old_domain.com', 'http://new_domain.com');  

where old_domain.com is the old domain and new_domain.com is the new domain

Changing the domain via normal phpmyadmin and text editor

Do export of WP database via phpmyadmin to local computer

file

Open DB in Notepadqq or Notepad2 text editor, shortcut Ctrl+H to bring up search window and replace all links from old address with new one

file

Import the database back via phpmyadmin into the newly created database and plug that database into wp-config.php

Check it works.

Updated Oct. 22, 2020