Changing a Domain in WordPress via phpMyAdmin

A step-by-step guide to updating your WordPress domain using SQL queries and a text editor

Attention

Before you start, make sure to back up your database.

Updating the domain using SQL queries in phpMyAdmin

Open phpMyAdmin → select your database → SQL tab. Run the following three 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');

Note

old_domain.com is your old domain

new_domain.com is the new one


Changing the domain via database export and a text editor

Export your WordPress database to your local computer.

file

Open the exported database in a text editor. Use Ctrl+H to open the Find and Replace tool and replace all old URLs with the new domain.

file

Import the updated database back into phpMyAdmin into the new database.

Update wp-config.php to connect to the new database.

Verify that the site works correctly and all links point to the new domain.

Need help?Our engineers will help you free of charge with any question in minutesContact us