How to Change WordPress URL in Database: A MySQL Tutorial Using phpMyAdmin

If you’re looking to change the WordPress URL in your database, you’ll need to use phpMyAdmin. phpMyAdmin is a free and open source tool used to manage MySQL databases. It’s a great tool for managing your WordPress database, and it’s easy to use.

In this tutorial, we’ll show you how to change the WordPress URL in your database using phpMyAdmin.

Step 1: Log into phpMyAdmin

The first step is to log into phpMyAdmin. You can do this by going to your hosting provider’s control panel and clicking on the phpMyAdmin icon.

Step 2: Select Your Database

Once you’re logged in, you’ll need to select the database that contains your WordPress installation. You can do this by clicking on the “Databases” tab at the top of the page.

Step 3: Select the wp_options Table

Once you’ve selected your database, you’ll need to select the wp_options table. This table contains all of the settings for your WordPress installation.

Step 4: Edit the Site URL

Once you’ve selected the wp_options table, you’ll need to find the “siteurl” row. This is the row that contains the URL of your WordPress installation. To edit this row, click on the “Edit” link next to it.

Step 5: Change the URL

Once you’ve clicked on the “Edit” link, you’ll be able to change the URL of your WordPress installation. Simply enter the new URL in the “option_value” field and click “Go” to save your changes.

Step 6: Log Out

Once you’ve saved your changes, you can log out of phpMyAdmin. Your WordPress URL has now been changed in your database.

And that’s it! You’ve successfully changed the WordPress URL in your database using phpMyAdmin.

WordPress uses MySQL database to store all its data, including site URLs. So if, for some reason, you need to change your WordPress URL, it’s necessary to tweak some data in MySQL. Keep reading to learn how to do it.

1. Determining the Name of WordPress MySQL Database

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:

  1. Access your hPanel and open File Manager.
  2. Select the domain name, then click Go to File Manager.
File Manager under the Files section of your hPanel.
  1. Open wp-config.php and search for DB_NAME. The value of this par#ameter is your database name. For instance, the name of our MySQL database is u923246418_gagap.
wp-config.php page, searching for DB_NAME
  1. Go to phpMyAdmin via your website’s control panel.
  2. The left panel lists all of your databases. Select the one connected to your WordPress site and head to the SQL tab.
phpMyAdmin run SQL query/queries on database
  1. 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');

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.

  • 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.
    This image shows that you have successfully changed your WordPress URLs
  • The last thing we need to do is verify the changes. Open the wp_options table and check the option_value ofsiteurl and home. You should see your new URL.
    The new URLs in wp_options table
  • 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.

    Conclusion

    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!

    Change WordPress URL in Database FAQ

    Once you know how to change WordPress URLs in your database, here are some frequently asked questions about the topic.

    How Do I Change the URL in MySQL?

    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.

    How Do I Connect My WordPress Website to MySQL Database?

    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.

    Can I Change My WordPress Database Name?

    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.

    How to Change WordPress URL in Database: A MySQL Tutorial Using phpMyAdmin

    If you’ve ever needed to change the WordPress URL in your database, you know it can be a daunting task. Fortunately, there’s an easy way to do it using phpMyAdmin. In this tutorial, we’ll show you how to change the WordPress URL in your database using phpMyAdmin.

    Step 1: Log into phpMyAdmin

    The first step is to log into phpMyAdmin. You can do this by going to your hosting control panel and clicking on the phpMyAdmin icon. Once you’re logged in, you’ll see a list of databases on the left side of the screen.

    Step 2: Select the WordPress Database

    Next, you’ll need to select the WordPress database. To do this, click on the database name in the left sidebar. This will open up the database and show you a list of tables.

    Step 3: Edit the wp_options Table

    Now, you’ll need to edit the wp_options table. To do this, click on the “wp_options” table in the left sidebar. This will open up the table and show you a list of options.

    Step 4: Change the WordPress URL

    Now, you’ll need to find the “siteurl” and “home” options. These are the options that control the WordPress URL. To change the WordPress URL, simply click on the “Edit” link next to the option and enter the new URL. Once you’ve done this, click the “Go” button to save the changes.

    Step 5: Test the New URL

    Once you’ve changed the WordPress URL, you’ll need to test it to make sure it’s working properly. To do this, simply open up a new browser window and enter the new URL. If everything is working properly, you should see your WordPress site.

    Conclusion

    Changing the WordPress URL in your database is a simple process when you use phpMyAdmin. Just follow the steps outlined in this tutorial and you’ll be able to change the WordPress URL in no time.

    Jaspreet Singh Ghuman

    Jaspreet Singh Ghuman

    Jassweb.com/

    Passionate Professional Blogger, Freelancer, WordPress Enthusiast, Digital Marketer, Web Developer, Server Operator, Networking Expert. Empowering online presence with diverse skills.

    jassweb logo

    Jassweb always keeps its services up-to-date with the latest trends in the market, providing its customers all over the world with high-end and easily extensible internet, intranet, and extranet products.

    Contact
    San Vito Al Tagliamento 33078
    Pordenone Italy
    Item added to cart.
    0 items - 0.00
    Open chat
    Scan the code
    Hello 👋
    Can we help you?