How to Change WordPress URL in Database: A MySQL Tutorial Using phpMyAdmin
1. Determining the Name of WordPress MySQL Database
Skip this part if you only have one MySQL database. However, if you have multiple databases and are not sure which one is connected to your WordPress, then follow the steps below.
WordPress stores the MySQL database names and their credentials in the wp-config.php file. You can find this file in your root file directory.
Access your File Manager.
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 replace your current URL, follow these steps:
- Go to 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.
 
 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.
Press Go. You will see success messages along with the number of changed rows. Note that the number of rows will be different for each WordPress website.
 The last thing we need to do is verify the changes. Open the wp_options table and check the option_value of siteurl and home. You should see your new URL.
 If you get error messages and the queries are not executing, check your code for syntax errors and make sure you are using the correct table prefix. Contact the hosting support for further assistance if the error persists.
Conclusion
We have just learned how to change WordPress URLs in the MySQL database using phpMyAdmin.
As we can see, all the steps above are quite straightforward. You just need to determine the correct database and then input some lines of code.

