May 27, 2024

How to Change WordPress URL in MySQL Database & Home Setting

If you want to start a journey with MySQL database then you need the best web hosting company provider for your business. If you are thinking of changing WordPress URLs in MySQL database then its the better article for you.

In this article, we will share easy steps to change your WordPress site URLs. WordPress is one of the popular online open-source website creation tools.

WordPress is an easy and most powerful website content management system. Follow the below simple method to change your WordPress URL in the MySQL database.

Find the Name of WordPress MySQL Database

The cheapest wordpress hosting India stores MySQL database name and other details inthe wp-config.phpfile. This file is available in your root file directory:

  1. Login to your cPanel and openFile Manager.
  2. Choose the domain name, and then press onGo to File Manager.
  3. Next openwp-config.phpand find theDB_NAME.The content of this parameter is your database name.

change wordpress url in mysql database

Change WordPress URLs in MySQL Database

In PhpMyAdmin, you can easily change all links on your website through directly updating the old URL in the WordPress database.

  • First, go to the phpMyAdminsection through your website control panel.
  • Then the left panel list is all of your databases. Select your database name and go to theSQLtab. SQL Tab allows you to quickly make changes to your database, simply inserting the appropriate code.
  • Enter the following SQL query into the SQL Tab to change the WordPress URL. Before, you have to updateoldurl.comwith your current WordPress site URL andnewurl.comwith your new WordPress site URL.
UPDATE wp_options SET option_value = replace(option_value, ‘’, ‘’) WHERE option_name = ‘home’ OR option_name = ‘siteurl’;

UPDATE wp_posts SET guid = replace(guid, ‘’,’’);

UPDATE wp_posts SET post_content = replace(post_content, ‘’, ‘’);

UPDATE wp_postmeta SET meta_value = replace(meta_value,’’,’’);

  • Click on theGobutton to execute a given query.You will receive a successful message. Now your current WordPress URL would be updated with the new WordPress URL.
  • The last step you necessitate to do is check all changes. First, open thewp_optionsand check theoption_valueofsite URLandhome.You should see your new WordPress URL.

Different Method to Change WordPress URL

You can skip this part if you understand how to change the WordPress URL in the MySQL database. There isn’t a single way to change the WordPress URL. In many different ways, you can change the WordPress URL.

  • Change the WordPress URL in the Admin area
  • Change the WordPress URL from wp-config.php File
  • Change the WordPress URL Using functions.php File
  • Change the WordPress URL By WP-CLI

Follow the various methods to change the WordPress URL. Now, let’s understand step by step to change the WordPress URL.

  1. Change the WordPress URL in the Admin area:

In this method, you have to enter the new site URL in two fields. First, access your WordPress admin area. It is the most common and easy method to change your WordPress URL.

Log in to your cPanel account and go to “Settings » Generalpage then you will see two options such as WordPress address, site address. Only, you have to enter your new URL in both fields to change your WordPress URL.

  1. TheSite Address(URL) is the address that people type in their browser to reach your WordPress website.
  2. TheWordPress Address(URL) is the address where your WordPress core files exist.

Click on the Save Changes button. Now, visit your website to make sure your website URL update or not.

  1. Change the WordPress URL in wp-config.php File:

First, you create a site backup and a copy of the current wp-config.php file before you start editing. Thewp-config.phpis a main WordPress configuration file generated when theWordPress installation.

In this method, you have to add the site URL to your WordPress configuration file named wp-config.php. Log in to your cPanel account and go to the File Manager. Find the wp-config.php file in the root of WordPress installation.

Just connect to your website using an FTP client and update the wp-config file that adds two lines of following code.

define( ‘WP_HOME’, ‘’ );

define( ‘WP_SITEURL’, ‘’ );

The replaces your new WordPress site URL. Now save the changes and upload them back to your server. After that, visit your website to make sure the site URL is updated or not.

  1. Change WordPress URL Using functions.php File:

Change the WordPress URL using functions.php file. That method is only for those users who cannot access the admin area of their WordPress website. You have to connect your WordPress site using an FTP client.

Go to the /wp-content/themes/your-theme-folder/. Once you locate the functions.php file and edit it using a plain text editor such as Notepad. Now, you want to add the below two lines of code:

update_option( ‘siteurl’, ‘’ );

update_option( ‘home’, ‘’ );.

The replace with your new site URLs. Now save all changes and upload the file back to your site hosting using FTP.

4. Redirection After Changing WordPress Urls

Once you transform your WordPress URLs, then you thought to ensure anybody working with the older URL is redirected into the brand new URL and will not have any mistakes. Our team takes review to read this for all types of reasonable SSD reseller hosting solutions under the exploration method.

In case you are with set up redirection with . Practice our knowledge-base guidebook to re-direction to master just how exactly to execute this and browse our guidebook to divert best-practices.

And to prevent redirect errors including lots of redirects’ and also figure out how to set this up therefore that it will not affect your web page’s efficiency. You may also must put in redirects for different pages or posts, but wild-card redirection is significantly more inclined.

In case you are unfamiliar with Kinsta, then learn if your web hosting provider enables you to set up wild card redirection on your controller panel.

When you are jogging top quality in your own website and you also have to edit that URL of different articles or pages. Then the plug-in will routinely set up arrangements on you personally, and therefore that you do not need to get this done by hand.

5. Determining the Name of WordPress MySQL Database & Home Setting

You may ignore this section in the event that you just have a single particular MySQL database. But when you’ve got several databases and also not sure which one is joined with WordPress. We are discussing following tips :

You may discover this document on your root directory listing:

  1. Accessibility to your cPanel and start document supervisor.
  2. Choose the domain name, click proceed to document supervisor
  3. Open up wp-config.php and look for DB_NAME. The worth of the parameter can be your own database title. For example, the identity of the MySQL database will be currently in file name.


There are a lot of complicated best hosting methods out there to change your WordPress site URL, but changing the WordPress URL in the MySQL database is quite easy.

Always make sure to do a backup of your WordPress sites, before changing the setting of the site URL. With the many website backup plugins available in WordPress, you can manage the backup feature in cPanel.

We hope this article can give you clear guidance on how to change WordPress URLs in the MySQL database. Follow the one simple step to change the WordPress URL in the MySQL database.

Leave a Reply

Your email address will not be published. Required fields are marked *