WordPress Change Site URL MySQL Query
Last Updated : Apr 14, 2023
IN - WordPress
In this article we will show you the solution of WordPress change site URL MySQL query, WordPress stores all of its data, including site URLs, in the MySQL database.
Therefore, you must make some changes to some MySQL data if you need to modify your WordPress URL for any reason. Continue reading to learn how.
This section is optional if you only have one MySQL database. If you have several databases, though, and are unsure which one is associated with your WordPress installation.
As we can see, all of the preceding steps are quite simple. You simply need to select the appropriate database and then enter some code.
We all regularly create demo websites on various demo domains prior to actually transferring these same files to an original domain.
It can be difficult to keep each of the URLs inside the database up to date so that all of the pages, links, and images function properly.
Step By Step Guide On WordPress Change Site URL MySQL Query :-
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');
- The wp-config.php file is where WordPress stores the names of the MySQL databases and the login information for each one.
- Select File Manager from your hPanel.
- To access the file manager, select the web address and then click it.
- Look for DB NAME in wp-config.php. This parameter's value is the name of your database. Our MySQL database, for instance, is called u923246418 gagap.
- Navigate to phpMyAdmin from the control panel of your website.
- Your databases are all listed in the left panel. Go to the SQL tab and choose the one that is linked to your WordPress website.
- Enter the SQL query mentioned in the above code block.
- In place of oldurl.com and newurl.com, respectively, enter your current and new WordPress addresses.
- Click the Go button. The number of happened to change rows and success messages are both displayed. Keep in mind that each WordPress website will have a different number of rows.
- The final step is to double-check the changes. Check the option values of siteurl and home in the wp options table. You should now be able in seeing your new URL.
As a result, we have successfully learned how to wordpress change site url mysql query.
Modifying your WordPress site but also home URL is a simple process that can be accomplished using phpMyAdmin.
There are a variety of situations in which you might need to change the URL, however, one of the most frequent ones is when you don't have access here to the previous location or are presently unable to log into the admin area of WordPress.
I hope this article on WordPress change site URL MySQL query helps you and the steps and method mentioned above are easy to follow and implement.