Getting Prepared

Change WordPress URL Using MySQL

Change WordPress URL Using MySQL

Change WordPress URL when moving a WordPress website, this can seem like a major task. There is actually a smooth, fast method to changing your WordPress domain with breaking image URLs or other asset URLs. Lets get started with our change WordPress URL tutorial.

  • Prefix Label*

  • Old URL*

  • New URL*

Enter Your Email And Get Notified When New WordPress Tools Are Available!

Please Backup Your Database Before Using Tool.

Step 1: Backup Your WordPress Site

Before you do anything major with your WordPress website, you should always create a complete backup. WordPress complete backup include everything inside the “wp-content” folder and the database that holds your WordPress data.

For more info see our tips on backing up WordPress.


Disclaimer: Remember backing up your database is vital to this process. We do not claim responsibility for any damages your site may endure from using this tool incorrectly!

Step 2: Locate Your WP Database Prefix

Every WordPress website has a database as you should already know by now. Your database is where your users, post content, image URLs and other awesome data is stored.

For this change WordPress URL tool to work correctly, you will need to locate the database prefix. The WordPress database prefix is a unique identifier that is attached to each relative table in your database. (fyi, this is not our real database and we do not recommend posting your database, this is only for the change WordPress URL tutorial)


Taking a look inside your database, you will find tables named:

Earning good online income?

Start Your Online Business Now!

Build A Site!
  • wp_posts
  • wp_users
  • wp_postmeta
  • And many more.

The  example above uses a database prefix of “wp_”. Don’t forget your “_”, underscore after the letters of wp as it’s also part of your prefix.

Keep in mind that not all WordPress sites will have the default “wp_” prefix. WP database prefixes can use any letters or numbers to create prefix. In fact, now days it’s highly recommended to have anything but default to better protect your database from hackers.

Step 3: Determine Old WordPress URL and New WordPress URL.

So chances are you made it to this tool because you want to change the URL of your WordPress site.

This part is fairly easy.

We need to know the URL that your site currently uses as that’s the “old” URL.

Then, you need the “new” domain/url that you want your WordPress site to work on.

Lets do an change WordPress URL example:

If I want to move EnsureDomains.com to EnsureHosting.com or even something as simple as EnsureDomain.com, Just to remove the “s” in domains…

EnsureDomains.com = “Old URL”

EnsureHosting.com = “New URL”

Or

EnsureDomain.com = “New URL”

Again this is only an example for those a little confused.

Wait! Is your website secure???

Now we need to look a little closer at our URL structure. We need to focus on whether our URLs are secure or standard.

When you access your WordPress website, does your URL have “https://” before your domain name? If so your website essentially has some type of SSL attached.

If your domain doesn’t show https and instead shows http:// then you may want to consider buying an SSL for your WordPress site.

You can read more here about installing an SSL on cpanel.

Regardless, when changing your WordPress site URL you want to include that piece of the URL.

Let’s use our last change WordPress URL example:

With SSL,

https://EnsureDomains.com = “Old URL”

https://EnsureHosting.com = “New URL”

Or without SSL,

http://EnsureDomains.com = “Old URL”

http://EnsureHosting.com = “New URL”

Step 4: Use The MySQL Command To Change WordPress URL

Once you have your prefix, old URL and new URL, you can build your MySQL command. If you have never used this type of command, don’t worry it’s not as complicated as it sounds.

Let’s change our WordPress URL,

Assuming you have access to your databases, we need to go inside “phpMyAdmin”.

Now let’s dive into the database that our WordPress site uses. Once inside that specific database, you will get a few new tabs at the top.

Open the SQL tab, there you should find an empty white text/code box. That’s where the code goes you just created with this WordPress URL tool.

Final notice: You should make sure you have a complete backup of this database before going beyond this point!

Copy the snippet from this page and paste it inside the text area. Some phpMyAdmin accounts include a test run button that allows you to see if any results or “rows” even change, Others may not be as fortunate. When you are ready, you can press the GO button to search your database for your old URL and change it to your new URL.

If an error occurs we can empty the current database and re-upload our backup WordPress database. That’s why we have a database backup right?

Then you would need to determine where things went wrong.

Step 5: Check Out Your WordPress Url Change

Hopefully you have already pointed the new domain to this installation.

By now you should be able to access your WordPress login via the new URL.

Always start with logging into your dashboard after a complete URL change. It’s a straight forward way to ensure everything is functioning properly.

Final thoughts on changing WordPress URL using MySQL

Overall, our way to change WordPress URL using MySQL Tool can take less than 5 minutes. Doing a WordPress URL migration by hand can take hours. Save yourself the time change your WordPress URL using MySQL!

From Experience as a WordPress developer

As a WordPress developer, I build sites on development domains, local host servers, and subdomains. It really depends on the particular project and who’s involved. I use this snippet to ensure a smooth URL switch over when moving each WordPress site.

After writers and content folks get their job done, you could easily end up having 16,000+ links to change.

I’ll let you think about how long that could take.

This snippet takes that to about a 1.6sec request and we spend our time looking for things MySQL may not have been able to locate or change by chance.

All in all, with the snippet I can do the full WordPress URL change within 20 minutes and that’s including a thorough look through for possible misses.

If you find this content valuable please take the time to join us on our email newsletter, Facebook, Twitter and in the comments!

Earning a great income online is no longer a myth!

Start Your Online Business Now!

Build A Site!

By |2018-07-01T22:41:01+00:00June 30th, 2018|WordPress Tools|0 Comments

Leave A Comment