Sometimes there is a need to change your WordPress site URL to a new URL. So, learn the simple methods to update site URLs across your website. You can easily change WordPress Site URL in MySQL database.
WordPress uses a MySQL database to store its website data, file and even website URLs. If you need to change the WordPress URL in MySQL, it’s necessary to change some basic setting in MySQL.
Determine Your Website Database Name
Before setup the WordPress change site url mysql, you need to determine the MySQL database name that presents in your cPanel account. Follow the below three steps to find your database name. Know How: ERP Software help Manufacturing Company
- Login into cPanel account and open File Manager.
- Open the wp-config.php file you can see this file in your root file directory.
- And search for DB_NAMEthis is your database name.
Change WordPress Site URL in MySQL Database
Let us now look at each step to change site URL WordPress MySQL. Please make sure you backup your database in cPanel before replacing URL in wordpress hosting price India database.
- Open the phpMyAdminby your website cPanel account.
- After clicking the phpMyAdmin icon, the left panel list all of your databases.
- Select your database name that connected to your WordPress site. Then, Go to the SQL tab. You can see in below Image.
- Click on SQL tab and insert the following SQL query into your SQL tab to changing the WordPress site URL using MySQL.
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');
- It’s quite easy to change your WordPress URL name. Just replace com with your current WordPress URL name and newurl.com with your new WordPress URL name.
- Then, you will get a success message now save the changes. Remember a number of the row will be separate for each WordPress site.
Go to your database in the left panel there are several tables appear you. Then click on the wp_options table and check the option value of site URL and home and press on Go button to save the information. If you receive any error messages and the SQL queries are not executing, then check your code for syntax errors otherwise you can Contact the hosting support for further help if the error continues.
Different Method to WordPress Change Site URL
There are a lot of ways you can change your WordPress URL. WordPress Address (URL) or Site Address (URL) both are different be careful when editing these values. You can choose the one method that functions best for you.
1] Change the WordPress URL in the Admin Dashboard:
It is the most common method to change the WordPress URL directly from the admin dashboard area. Log in to the Admin section of your WordPress site, and then click on the Settings from the left sidebar.
At the General Settings page, you will see two good web hosting space URL option: WordPress Address URL and Site Address URL. If you change your WordPress URL, you will need to change your WordPress Address and Site Address.
- WordPress Address (URL) is the place where WordPress files and folders are stored.
- Site Address (URL) is the address you want people to type in their address bar to reach your WordPress site.
Enter the new URLs in WordPress Address (URL), Site Address (URL) and click on the Save Changes button given at the settings page. Now, you will be ready to access your website on the new WordPress URLs.
2] Change your WordPress URLs Using functions. Php File
If you cannot access the admin area to change your WordPress site URL, then you can change your WordPress URL using function.php file.
- Just connect to your WordPress website using an FTP client and then go to /wp-content/themes/your-theme-folder/
- Go to php file and edit it using a plain text editor like Notepad or you can choose any other. Add the following two lines of code at the bottom.
- update_option( ‘siteurl’, ‘https://example.com’ );
- update_option( ‘home’, ‘https://example.com’ );
- Then replace https://example.com with your site URL. Save changes and upload the file to your site hosting using FTP.
- The benefit of this method is that you can update the website URLs in the database. After that, remove the two lines of code from your WordPress phpfile.
As you can understand, you need to learn all the steps to change site URL WordPress MySQL. Just input some lines of code in the SQL tab of the cPanel Account.
Change WordPress URL from MySQL Database is a pretty simple method you can utilize to change your WordPress URL. You can change the URL name directly in the WordPress database using phpMyAdmin. Check this cheap unlimited reseller hosting
We hope this article can give you clear guidance on how to change the WordPress site URL in the MySQL database and how to determine your database name. So follow that entire step
Change WordPress Site URL in MySQL Database
If you need to change the WordPress URL in MySQL, it’s necessary to change some basic setting in MySQL.