WordPress uses the MySQL database to store all its data, including the site URL. Therefore, if you need to change the WordPress URL for some reason, it is necessary to adjust some data in the MySQL. Read on to learn how to do this.
1. 0 in MySQL database. Determine the name of the WordPress website MySQL database
if you have only one MySQL database, skip this section. However, if you have multiple databases and are not sure which database is connected to your WordPress, follow these steps.
WordPress stores the MySQL database name and its credentials in the wp-config.php file. You can find this file in the root file directory:
1. Access your pagoda panel and open the file menu.
2. Enter / www/wwwroot to select the corresponding domain name of the website and enter the WordPress installation directory.
3. Open wp-config.php and search for DB_NAME. The value of this parameter is your database name. For example, the name of our MySQL database is u923246418_gagap.
2. To change the WordPress URL
in the MySQL database to replace your current URL, perform the following steps:
1. Go to phpMyAdmin through the control panel of your website.
2. The left panel lists all your databases. Select the one that connects to your WordPress site, and then go to the SQL tab.
3. 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');
replacesoldurl.comwith your current WordPress address andnewurl.comwith your new WordPress address.
Note: your table prefix may not be wp_. View the correct table prefix on the left panel of phpMyAdmin and update the SQL query.
press start. You will see a success message and the number of rows changed. Note that the number of rows varies for each WordPress site.
the last thing we need to do is validate the changes. Open the wp_options table and check the option_value of siteurl and home. You should see the new URL.
if you receive an error message and the query is not executed, check your code for syntax errors and make sure you are using the correct table prefix. If the error persists with , contact managed support for further assistance.
warm Tip: if you are changing the domain name of the whole site, you may also need to replace the old domain name old.domain.com with new.domain.com.
summary
through database search and replacement. We just learned how to use phpMyAdmin to change the WordPress URL in the MySQL database.
, as we have seen, all of the above steps are very simple. You just need to determine the correct database and enter some lines of code.