Wednesday, March 18, 2015

To change the siteurl value in wordpress using mysql

While during a wordpress migration, here i need to change the domain name. Currently, after WP migration all the links are pointing to the old domain name. We can solve this my updating a field in mysql DB.

Changing WordPress Home URL and Site URL via MySQL database.

Login to Mysql
use Database_name;
SELECT * FROM wp_options WHERE option_name = 'home';
       This will show the current site url
UPDATE wp_options SET option_value="" WHERE option_name = "home";
       Verify whether the change got reflected
SELECT * FROM wp_options WHERE option_name = 'siteurl';