WordPress relies on MySQL database to store all its data, including your website URL. So, if you wish to change your website address you need to update it in MySQL as well. You can follow this article and easily update your website address to a new one.
Figuring out what’s the Name of WordPress MySQL Database
WordPress stores the MySQL database name, username and their password in the wp-config.php file. You can find this file in your root file directory
Open wp-config.php and search for DB_NAME. The value of this parameter is your database name. You may also note down the username and password because phpMyAdmin might ask you to enter those depending on your hosting provider.
Changing WordPress URLs in MySQL Database using phpMyAdmin
To replace your current URL, follow these steps:
- Go to phpMyAdmin from your hosting 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:
Note: Replace oldurl.com with your current WordPress address and newurl.com with your new WordPress address.
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.