WordPress Domain Change

Changing the Domain name on a WordPress site

When unable to get into worpress because the domain name has changed, the simplest and quickest way to install the new domain name in the wordpress site is to edit the database, as that is where wordpress software likes to store all of its data variables, except for the sites content.

#  mysql -u root -p

# MariaDB [none]>  show databases;  
                                             ( will list all the database names )
# MariaDB [none]>  use wordpress-database-name;
                 ( this is the name that would be in the wp-config.php file )
                                          
The existing values in the database ( say called "wordpress-database-name" )
can be displayed for the old domain name, ( say "existing-domain-name.com").
# MariaDB [ wordpress-database-name ]> select option_name, 
                >  option_value  from wp_options 
               > where option_value="http://existing-domain-name.com";

So there are two values to change in the table "wp_options".
MariaDB [ wordpress-databse-name ]> update wp_options 
                > set option_value="http://new-domain-name.com" 
               > where option_name="home";

MariaDB [ wordpress-databse-name ]> update wp_options 
              > set option_value="http://new-domain-name.com" 
             > where option_name="siteurl";

MariaDB [ wordpress-databse-name ]> exit

Clear the browser’s cache and try again http://new-domain-name.com

© 2017, James Harry Burton. All rights reserved.