This blog explains how to change the wordpress site and home URL using both command line and phpMyAdmin methods. Firstly we discuss using the command line method.

 

How to change wordpress site url  from commandline ?

Before going to the command line method, make sure that we have root access to the mysql server. If we have  root access, then access the mysql server using the below command.

$mysql -u root -p

Then provide the mysql root password.

Then it will take us to the mysql console.

or simply type mysql on the command prompt.

$ mysql

Change Site & Home URL of WordPress Website from phpMyAdmin and Command line

After that we need to change the database to a wordpress database specified the wp-config.php using the below command.

$ use database_name;

Then show tables on the database.

$ show tables;

You will see something like this:

 

 +————+————+————+—————+—————+

 | Tables_in_database |

 +————+————+————+—————+—————+

 | wp_commentmeta           |

 | wp_comments              |

 | wp_links                 |

 | wp_options               |

 | wp_postmeta              |

 | wp_posts                 |

 | wp_term_relationships    |

 | wp_term_taxonomy         |

 | wp_terms                 |

 | wp_usermeta              |

 | wp_users                 |

 +————+————+————+—————+—————+

 11 rows in set (0.00 sec)

Then follow up the below commands to change the URLs.

mysql> SELECT * from wp_options WHERE option_name = 'home' OR option_name = 'siteurl';

 

mysql> UPDATE wp_options SET option_value = http://www.example.com/blog   WHERE option_name = 'home' OR option_name = 'siteurl';

How to change WordPress URL  using PhpMyadmin ?

1. Open PhpMyAdmin.

2.Click your database in the left pane. Several tables appear below it. Click on your wp_options table.

Change Site & Home URL of WordPress Website from phpMyAdmin and Command line

3.Locate the siteurl and home rows. Click the Edit option to make changes.

Change Site & Home URL of WordPress Website from phpMyAdmin and Command line

4. Click the pencil icon next to each to edit.

Change Site & Home URL of WordPress Website from phpMyAdmin and Command line

5. Change the URL by typing a new one.

6. Click the Go button to save the settings. Do this for both the site URL and home options.

Now we have learned how to change wordpress website and home url  using  PhpMyAdmin and Command line.At Iserversupport we have dedicated and trained  team for windows server management. If you want to get any support don’t hesitate to contact our server management team.