Sometimes mistakes or installations on the incorrect URL can make it necessary to be able to change the site URL through PHPMyAdmin.

Do you have a WordPress site that is trying to load the wrong URL? Is http://example.com coming up instead of http://example.com/wordpress ? Or http://123.234.12.13/~somename instead of http://yourdomain.com ?

Here is how to fix it! (Be careful, as you do this. If you’re unsure of yourself, backup your database first: http://codex.wordpress.org/Backing_Up_Your_Database)

First log into PHPMyAdmin.

How to Access PHPMyAdmin to Change WordPress URL

Enter your username and password. (Note, for BlueHost users, if you are unable to log into PHPMyAdmin, you may need to set your MySQL Password first. This can be set using the “Reset MySQL Password Link” also shown in the screenshot above, and featured in the screenshot below)

Logging into PHPMyAdmin

This step may only be shown on BlueHost. If you do not see this, don't worry

A list of your databases will appear on the left. Select your desired database then click the browse icon for the options table. Hovering over this icon should show the word “browse”. (If you aren’t sure which database is the right one, check your wp-config.php file to check what your database is)

Accessing the wp-options table to Change WordPress URL (Don’t worry, I cleaned up my overhead after!)

You will then be presented with a lot of options. Look for the option_name of siteurl and click the little pencil(edit) icon.

Editing the siteurl option_name to change the URL in PHPMyAdmin

After clicking the pencil button, you should see something like the below screenshot. Change the URL in the option_value field, but do not change anything else. (Do *not put a slash after the URL.) Then click “Go”.

Entering the updated URL into PHPMyAdmin

You will be taken back to the screen you were on previously. Here you will need to go to the second page. Click the arrow button as shown below:

Going to the second page in PHPMyAdmin

Once again you will see a long list of options. Look for the home option_name and click the little pencil icon again:

Accessing the home option_name to change WordPress URL in PHPMyAdmin

Once again you will be taken to a screen where you can edit the option_value. Change the URL in the option_value field, but do not change anything else. (Do *not put a slash after the URL.) Then click “Go”.

Editing the home URL in PHPMyAdmin

That should be it! Your site URL has now been updated!

—————————————————————-

(On a separate note, if you had a lot of posts, chances are that images and internal links within your posts may still be broken. You can do the following to fix it.)

In PHPMyAdmin, go to your wp_posts table and click the SQL option at the top. Put something like the following code into it. (Be sure to replace the URLs with your real old and new locations.):

UPDATE wp_posts
SET guid =
REPLACE(

guid,
"olddomain.com/wordpress",
"www.newdomain.com"

);

Click “GO” and … that’s it! You’re done.

(On another separate note, sometimes you have to update your .htaccess too. For example, if you moved your site from domain.com/wp to just domain.com, you would need to edit your .htaccess and change the RewriteBase from /wp/ to just / and also change the RewriteRule line from . /wp/index.php to just /index.php )

Be Sociable, Share!