WordPress uses a MySQL database to store information, including site URLs. If you want to change your WordPress URL, update it in MySQL. The question is why do you need to change url? There are several reasons to change the url but one of the most important reasons is when you are going to transfer or migrate your website from a demo or development server to a live or production server. This article will guide you through the process, so keep reading to learn how to do it.
Changing WordPress URLs in MySQL Database Tables
To change your current URL, follow these steps:
- Go to phpMyAdmin via your website’s control panel or any other third party mysql db connecting tools.
- The left panel check your installed or imported wordpress database. and click the one connected to your WordPress site and head to the SQL tab.
- Execute the following SQL query in SQL query panel:
— UPDATE wp_options SET option_value = replace(option_value, ‘oldurl.com’, ‘newurl.com’) WHERE option_name = ‘home’ OR option_name = ‘siteurl’;
— UPDATE wp_posts SET guid = replace(guid, ‘oldurl.com’,’newurl.com’);
— UPDATE wp_posts SET post_content = replace(post_content, ‘oldurl.com’, ‘newurl.com’);
— UPDATE wp_postmeta SET meta_value = replace(meta_value,’oldurl.com’,’newurl.com’);
Replace oldurl.com with your current WordPress address and newurl.com with your new WordPress address.
Important! Your table prefix might not be wp_. See the correct table prefix on the left panel of phpMyAdmin, and update the SQL query.
Conclusion:
We have learned how to change WordPress URL in MySQL database using phpMyAdmin.
As you can see, all the steps above are very simple. All you have to do is choose the right database and then enter a few lines of code.
I hope this tutorial can give you clear instructions on how to change WordPress URL in MySQL database. If you have any questions, please leave them below!
Recent Comments