Change WordPress Site URL Via phpMyAdmin

Changing your WordPress site and home URL is an easy process that can be done via phpMyAdmin. There are many reasons why you might need to do this, but one of the most common ones would be changing the URL when you do not have access to the previous location or cannot currently access the WordPress admin area. Although this article assumes you are using cPanel, if you skip down to step 4 below, the directions should be the same regardless of how you access phpMyAdmin.


Important!

It is critical that you create a backup of your WordPress database before making changes. That way, if you make a mistake, you can restore your database and try again. You may want to check on the following article on how to backup your database: 

How to backup your mySQL database in cPanel


  1. Look up the WordPress database name if you don't know it already. It can typically be found in the wp-config.php file where your WordPress site files are located. Look for a line like this, and your database name appears near the end of the line:

    define('DB_NAME', 'your_db_name_here');
  2. Log into the cPanel account for the domain in question. The URL to log into your cPanel account typically looks something like this (use your own domain name or use your new site's IP address rather than domain name): https://yourdomain.com/cpanel 

  3. In the Databases section of cPanel, click on phpMyAdmin to open the database editing tool.
    The phpMyAdmin Icon in cPanel
  4. In the phpMyAdmin sidebar, find the options table in your WordPress database. To do that, you may need to click the + symbol next to your username and then locate the name of the database and click the + next to that. Finally select the options table itself by clicking on the actual text of the name (and not on the + like you did the others). This will load the table contents into the main part of this screen.
    Select the Wp_options Table in Your WP Database

    Often the name of the WordPress options table will be wp_options but it doesn't have to be. The letters and underscore character before the word "options" are known as the database prefix and the prefix could be anything at all or missing entirely. Just look for "options" in the table name and that is probably the correct one.

  5. Look for the row with siteurl in the option_name column. It will probably be the first row, but if not, use the Filter rows: field above the table to locate it.
    Locate the Siteurl row in the Wp_options Table
  6. Click the Edit button at the beginning of the siteurl row so you can change the option_value.
    Click the Edit Button at the Beginning of the Siteurl Row
  7. Look for the large Value field in the option_value row. Don't change anything other than the URL listed in that box or you may break WordPress. 
    Change the URL in the Option_value in phpMyAdmin
  8. Save your change if you're certain it is correct. Make sure Save and Go back to previous page are selected from the drop down menu items at the bottom of the screen and click the Go button.
    Save changes to the Siteurl in phpMyAdmin
  9. Now we have to repeat the same steps for the home option.  Look for the row with home in the option_name column. It will probably be the second row, but if not, use the Filter rows: field above the table to locate it.
    Find the home row in the Wp_options Table
  10. Click the Edit button at the beginning of the home row so you can change the option_value.
    Click Edit in the Home Row of the Wp_options Table
  11. Look for the large Value field in the option_value row. Don't change anything other than the URL listed in that box or you may break WordPress. 
    Change Only the Option_value in the Wp_options Table
  12. Save your change if you're certain it is correct. Make sure Save and Go back to previous page are selected from the drop down menu items at the bottom of the screen and click the Go button.
    Save the Changes to the Wp_options Table in phpMyAdmin

    What is the difference between the siteurl value and the home value? The home value is URL you want people to enter into their browser's address bar to go to your site. The siteurl value is the URL where your WordPress installation is actually located.

    In most cases both URLs should be exactly the same.

  13. Test accessing your WordPress site from the new URL. Please note that you may need to update certain links in your site to properly reflect the new location. Thankfully, there is at least one plugin that can help with this process.


More Info

There are other ways to make this change, either temporarily or permanently. Check the following page for more information:

https://codex.wordpress.org/Changing_The_Site_URL