Mar 02, 2026
Domantas G.
3min Read
WordPress relies on the MySQL database to store its data, including site URLs. If you ever need to change your WordPress URL, you have to make adjustments in MySQL.
This creates a problem when you need to change the website’s domain and URL. Not only will your site address change, but all internal links stored in the database will also be broken.
Fortunately, it is an easy fix to update the site address and domain. In this article, we will walk you through the easy way of changing the WordPress URL in a MySQL database using phpMyAdmin.
Download all-in-one WordPress cheat sheet
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:



To replace your current URL, follow these steps:

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.


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.
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.
We hope this tutorial can give you clear guidance on how to change WordPress URLs in the MySQL database. Kindly leave any questions you have below!
How to Locate and Create the WordPress .htaccess File on cPanel and hPanel
How to Perform a WordPress Search and Replace in the Database
Basics of Using WordPress WP_Query + Examples With Code
How to Use XAMPP to Set Up a Local WordPress Site
How to Speed Up a WordPress Site
Once you know how to change WordPress URLs in your database, here are some frequently asked questions about the topic.
Changing the URL in MySQL requires some technical knowledge. First, you’ll need to open the database where your URL is stored, often in the data folder within your MySQL installation directory. Then, use a text editor to find and replace all instances of the old URL with the new one.
First, log in to your hosting account and launch phpMyAdmin. There, click on the Import link from the top menu and then the Choose file button. Select your WordPress database to connect the two.
Yes, it is possible to change your WordPress database name. Once you access the phpMyAdmin from your hosting account, click on the Operations tab. Under Rename database to, enter the new name and click Go.