HOW TO MANUALLY CHANGE URLs IN WORDPRESS DATABASE AFTER MIGRATING TO A NEW DOMAIN

So, you know WordPress stores all its important stuff, like website addresses, in something called a MySQL database. And if you want to switch up your WordPress URL, you’ll need to tweak things a bit in MySQL. Don’t worry, I’ve got your back—I’ll walk you through the steps right here in this article. Just keep on reading to find out how it’s done!

1)Finding the Name of WordPress MySQL Database.

If you’ve got just one MySQL database, you can totally skip this section. But, if you’ve got a bunch of them and you’re not quite sure which one is the WordPress champ, then here’s what you can do: So, here’s the scoop: WordPress keeps track of its favorite databases and their secret codes in a file called wp-config.php. You can locate this file in the main folder of your website

  • Access your cPanel and open File Manager.
  • Click on the domain name, then click Go to File Manage

3) Open wp-config.php and search for DB_NAME. The value of this parameter is your database name. For instance, the name of our MySQL database is u123456789_gagap.

2) Changing WordPress URLs in MySQL Database

To  substitute your current URL, follow these steps:

  • select phpMyAdmin via your website’s control panel.

The left panel lists all of your databases. Select the one connected to your WordPress site and head to the SQL tab.

  1. Changing WordPress URLs in MySQL Database

To replace your current URL, follow these steps:

  • Go to phpMyAdminvia your website’s control panel.
  • The left panel lists all of your databases. Select the one connected to your WordPress site and head to the SQL
  • Enter the following SQL query:

UPDATE wp_options SET option_value = replace(option_value, ‘oldurl.com’, ‘newurl.com’) WHERE option_name = ‘home’ OR option_name = ‘siteurl’;UPDATE wp_posts SET guid = replace(guid, ‘oldurl.com’,’newurl.com’);UPDATE wp_posts SET post_content = replace(post_content, ‘oldurl.com’, ‘newurl.com’); UPDATE wp_postmeta SET meta_value = replace(meta_value,’oldurl.com’,’newurl.com’);

Replace oldurl.com with your current WordPress address and newurl.com with your new WordPress address.

Important! Your table prefix might not be wp_. See the correct table prefix on the left panel of phpMyAdmin, and update the SQL query.

Click on the “Go” button. You’ll then be greeted with success messages and a       count of the altered rows. Just remember, this row count might vary for each   WordPress website

One final task remains: confirming the modifications. Access the wp_options table and examine the option_value for both ‘siteurl’ and ‘home’. Your brand new URL should be right there in plain sight.

In case you encounter error messages and the queries aren’t going as planned, it’s a good idea to double-check your code for any syntax blunders and ensure you’re using the right table prefix. If the error sticks around, don’t hesitate to reach out to your hosting support for additional help.

Conclusion

Congratulations! You’ve now mastered the art of switching up WordPress URLs right in the MySQL database using phpMyAdmin.

As you’ve seen, each step we covered is pretty simple. Just pinpoint the right database and throw in a few lines of code – voila!

Our aim with this tutorial was to offer you a crystal-clear roadmap for altering WordPress URLs in the MySQL database. If you’ve got any questions, feel free to drop them below. Happy website tweaking!

Menu