Useful mysql queries for wordpress migration

For developers wordpress moving site to new server is daily job. wp migration is easy with mysql query. Here is useful mysql queries for wordpress migration. This mysql query are very useful for moving wordpress data to new server.

Note: before executing following queries, first take backup of wordpress database first. it is very important for safety and backup purpose. I recommend, always take database backup while doing any database operation. Taking database backup is good practice.

When you want to change your domain name for wordpress site. You need to first take backup of your file system and mysql database. Make sure that backup is completely taken. Verify with any wordpress developer. Then only you start the migration. For wordpress domain migration following mysql queries are required.

mysql queries for wordpress migration

I already written detail article for this. You should read following article.

https://purabtech.in/wordpress-migration-hosting-service-domain/

Here is list of mysql queries which are very important when you are doing the wordpress site migration.

UPDATE wp_options SET option_value = REPLACE(option_value, 'oldsite.com', 'newsite.com');
UPDATE wp_postmeta SET meta_value = REPLACE(meta_value, 'oldsite.com', 'newsite.com');
UPDATE wp_posts SET post_content = REPLACE(post_content, 'oldsite.com', 'newsite.com');
UPDATE wp_posts SET post_excerpt = REPLACE(post_excerpt, 'oldsite.com', 'newsite.com');
UPDATE wp_posts SET guid = REPLACE(guid, 'oldsite.com', 'newsite.com');
mysql queries for wordpress migration
mysql queries for wordpress migration

Published by

Purab

I am Purab from India, Software development is my profession and teaching is my passion. Programmers blog dedicated to the JAVA, Python, PHP, DevOps and Opensource Frameworks. Purab's Github Repo Youtube Chanel Video Tutorials Connect to on LinkedIn

One thought on “Useful mysql queries for wordpress migration”

Leave a Reply

Your email address will not be published.