Wordpress change siteurl and home url using sql command


If we want to migrate a wordpress website from localhost or from development server to actual new domain then we  need to  change wordpress siteurl and homeurl.

To change the siteurl and home url in WordPress using SQL commands, you can follow these steps:

  1. Access your WordPress database through phpMyAdmin or any other database management tool.
  2. Locate the wp_options table and click on it to open it.
  3. Find the siteurl and home rows in the table and click on the "Edit" button next to each row.
  4. Change the value in the "option_value" column to your new URL and click the "Go" button to save your changes.
  5. Once you have updated both rows, clear your browser cache and refresh your WordPress site to see the changes take effect.

Here is an example of the MySQL commands to update the siteurl and home values in the wp_options table:


UPDATE wp_options SET option_value = 'https://www.codentricks.com' WHERE option_name = 'siteurl';
UPDATE wp_options SET option_value = 'https://www.codentricks.com' WHERE option_name = 'home';


Note that you should replace
https://www.codentricks.com
with your actual new URL. It is also important to make a backup of your database before making any changes.


 Category : Education   Posted By : Sanjay   on 2023-05-07 01:24:46


Related Post

Login



Categories

May I Know You

  • System » Unknown
  • Browser » Unknown
  • IP Address » 216.73.216.116