All TalkersCode Topics

Follow TalkersCode On Social Media

devloprr.com - A Social Media Network for developers Join Now ➔

WordPress Change Site URL MySQL Query

Last Updated : Mar 11, 2024

WordPress Change Site URL MySQL Query

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');
  1. The wp-config.php file is where WordPress stores the names of the MySQL databases and the login information for each one.
  2. Select File Manager from your hPanel.WordPress Change Site URL MySQL Query
  3. To access the file manager, select the web address and then click it.WordPress Change Site URL MySQL Query
  4. 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.WordPress Change Site URL MySQL QueryWordPress Change Site URL MySQL Query
  5. Navigate to phpMyAdmin from the control panel of your website.
  6. 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.WordPress Change Site URL MySQL Query
  7. Enter the SQL query mentioned in the above code block.WordPress Change Site URL MySQL Query
  8. In place of oldurl.com and newurl.com, respectively, enter your current and new WordPress addresses.
  9. 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.
  10. 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.

Conclusion :-

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.

Author Image About Amruta

Amruta is an Experienced web developer with 4 years for experience she completed her master's with MCA and passionate about programming Languages for creating technical contents like HTML, CSS, JavaScript, Java, Python, PHP, jQuery.

Follow Amruta On Linkedin 🡪