{"id":534,"date":"2019-11-13T04:34:42","date_gmt":"2019-11-13T04:34:42","guid":{"rendered":"http:\/\/blog.hostinger.io\/hostinger-tutorials\/%category\/wordpresshow-to-change-wordpress-urls-in-mysql-database-using-phpmyadmin\/"},"modified":"2026-03-10T09:36:57","modified_gmt":"2026-03-10T09:36:57","slug":"how-to-change-wordpress-urls-in-mysql-database","status":"publish","type":"post","link":"\/ph\/tutorials\/how-to-change-wordpress-urls-in-mysql-database","title":{"rendered":"How to change WordPress URL in database: A MySQL tutorial using phpMyAdmin"},"content":{"rendered":"<?xml encoding=\"utf-8\" ?><p>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. <\/p><p>This creates a problem when you need to change the website&rsquo;s domain and URL. Not only will your site address change, but all internal links stored in the database will also be broken.<\/p><p>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.<\/p><p class=\"has-text-align-center\"><a href=\"https:\/\/assets.hostinger.com\/content\/tutorials\/pdf\/Mega-WordPress-Cheat-EN.pdf\" target=\"_blank\" rel=\"noopener\">Download all in one WordPress cheat sheet<\/a><\/p><p>\n\n\n\n\n<\/p><h2 class=\"wp-block-heading\" id=\"h-1-determining-the-name-of-wordpress-mysql-database\">1. Determining the Name of WordPress MySQL Database<\/h2><p>Skip this part if you only have one <a href=\"\/ph\/tutorials\/what-is-mysql\">MySQL<\/a> database. However, if you have multiple databases and are not sure which one is connected to your WordPress, then follow the steps below.<\/p><p>WordPress stores the MySQL database names and their credentials in the <a href=\"\/ph\/tutorials\/wp-config-php\">wp-config.php<\/a> file. You can find this file in your root file directory:<\/p><ol class=\"wp-block-list\">\n<li>Access your hPanel and open File Manager.<\/li>\n\n\n\n<li>Select the domain name, then click <strong>Go to File Manager<\/strong>.<\/li>\n<\/ol><figure class=\"wp-block-image size-large\"><a href=\"https:\/\/www.hostinger.com\/tutorials\/wp-content\/uploads\/sites\/2\/2023\/04\/hpanel-dashboard-filemanager-highlighted.png\"><img decoding=\"async\" width=\"1024\" height=\"627\" src=\"https:\/\/www.hostinger.com\/tutorials\/wp-content\/uploads\/sites\/2\/2023\/04\/hpanel-dashboard-filemanager-highlighted-1024x627.png\" alt=\"hPanel dashboard, File manager highlighted\" class=\"wp-image-83743\" srcset=\"https:\/\/www.hostinger.com\/ph\/tutorials\/wp-content\/uploads\/sites\/44\/2023\/04\/hpanel-dashboard-filemanager-highlighted.png 1024w, https:\/\/www.hostinger.com\/ph\/tutorials\/wp-content\/uploads\/sites\/44\/2023\/04\/hpanel-dashboard-filemanager-highlighted-300x184.png 300w, https:\/\/www.hostinger.com\/ph\/tutorials\/wp-content\/uploads\/sites\/44\/2023\/04\/hpanel-dashboard-filemanager-highlighted-150x92.png 150w, https:\/\/www.hostinger.com\/ph\/tutorials\/wp-content\/uploads\/sites\/44\/2023\/04\/hpanel-dashboard-filemanager-highlighted-768x470.png 768w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure><ol start=\"3\" class=\"wp-block-list\">\n<li>Open <strong>wp-config.php<\/strong> and search for <strong>DB_NAME. <\/strong>The value of this parameter is your database name. For instance, the name of our MySQL database is <strong>u123456789_gagap<\/strong>.<\/li>\n<\/ol><figure class=\"wp-block-image size-full\"><a href=\"https:\/\/www.hostinger.com\/tutorials\/wp-content\/uploads\/sites\/2\/2023\/03\/filemanager-publichtml-wpconfig-dbname-1.png\"><img decoding=\"async\" width=\"954\" height=\"632\" src=\"https:\/\/www.hostinger.com\/tutorials\/wp-content\/uploads\/sites\/2\/2023\/03\/filemanager-publichtml-wpconfig-dbname-1.png\" alt=\"wp-config file, database username highlighted\" class=\"wp-image-80705\" srcset=\"https:\/\/www.hostinger.com\/ph\/tutorials\/wp-content\/uploads\/sites\/44\/2023\/03\/filemanager-publichtml-wpconfig-dbname-1.png 954w, https:\/\/www.hostinger.com\/ph\/tutorials\/wp-content\/uploads\/sites\/44\/2023\/03\/filemanager-publichtml-wpconfig-dbname-1-300x199.png 300w, https:\/\/www.hostinger.com\/ph\/tutorials\/wp-content\/uploads\/sites\/44\/2023\/03\/filemanager-publichtml-wpconfig-dbname-1-150x99.png 150w, https:\/\/www.hostinger.com\/ph\/tutorials\/wp-content\/uploads\/sites\/44\/2023\/03\/filemanager-publichtml-wpconfig-dbname-1-768x509.png 768w\" sizes=\"(max-width: 954px) 100vw, 954px\" \/><\/a><\/figure><?xml encoding=\"utf-8\" ?><figure class=\"wp-block-image size-large\"><a href=\"\/ph\/wordpress-hosting\" target=\"_blank\" rel=\"noreferrer noopener\"><img decoding=\"async\" width=\"1024\" height=\"300\" src=\"https:\/\/www.hostinger.com\/tutorials\/wp-content\/uploads\/sites\/2\/2024\/06\/New-WP_in-text-banner-1024x300.png\" alt=\"\" class=\"wp-image-111781\" srcset=\"https:\/\/www.hostinger.com\/ph\/tutorials\/wp-content\/uploads\/sites\/44\/2024\/06\/New-WP_in-text-banner-1024x300.png 1024w, https:\/\/www.hostinger.com\/ph\/tutorials\/wp-content\/uploads\/sites\/44\/2024\/06\/New-WP_in-text-banner-300x88.png 300w, https:\/\/www.hostinger.com\/ph\/tutorials\/wp-content\/uploads\/sites\/44\/2024\/06\/New-WP_in-text-banner-150x44.png 150w, https:\/\/www.hostinger.com\/ph\/tutorials\/wp-content\/uploads\/sites\/44\/2024\/06\/New-WP_in-text-banner-768x225.png 768w, https:\/\/www.hostinger.com\/ph\/tutorials\/wp-content\/uploads\/sites\/44\/2024\/06\/New-WP_in-text-banner-1536x450.png 1536w, https:\/\/www.hostinger.com\/ph\/tutorials\/wp-content\/uploads\/sites\/44\/2024\/06\/New-WP_in-text-banner.png 2048w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure><h2 class=\"wp-block-heading\" id=\"h-2-changing-wordpress-urls-in-mysql-database\">2. Changing WordPress URLs in MySQL Database<\/h2><p>To replace your current URL, follow these steps:<\/p><ol class=\"wp-block-list\">\n<li>Go to <strong>phpMyAdmin<\/strong> via your website&rsquo;s control panel.<\/li>\n\n\n\n<li>The left panel lists all of your databases. Select the one connected to your WordPress site and head to the <strong>SQL <\/strong>tab.<\/li>\n<\/ol><figure class=\"wp-block-image size-large\"><a href=\"https:\/\/www.hostinger.com\/tutorials\/wp-content\/uploads\/sites\/2\/2019\/11\/Screenshot-2023-01-26-at-17.46.09.png\"><img decoding=\"async\" width=\"1024\" height=\"325\" src=\"https:\/\/www.hostinger.com\/tutorials\/wp-content\/uploads\/sites\/2\/2019\/11\/Screenshot-2023-01-26-at-17.46.09-1024x325.png\" alt=\"phpMyAdmin run SQL query\/queries on database\" class=\"wp-image-76353\" srcset=\"https:\/\/www.hostinger.com\/ph\/tutorials\/wp-content\/uploads\/sites\/44\/2019\/11\/Screenshot-2023-01-26-at-17.46.09.png 1024w, https:\/\/www.hostinger.com\/ph\/tutorials\/wp-content\/uploads\/sites\/44\/2019\/11\/Screenshot-2023-01-26-at-17.46.09-300x95.png 300w, https:\/\/www.hostinger.com\/ph\/tutorials\/wp-content\/uploads\/sites\/44\/2019\/11\/Screenshot-2023-01-26-at-17.46.09-150x48.png 150w, https:\/\/www.hostinger.com\/ph\/tutorials\/wp-content\/uploads\/sites\/44\/2019\/11\/Screenshot-2023-01-26-at-17.46.09-768x244.png 768w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure><ol start=\"3\" class=\"wp-block-list\">\n<li>Enter the following SQL query<strong>:<\/strong><\/li>\n<\/ol><pre class=\"wp-block-preformatted\"><strong>\n<\/strong>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');<\/pre><p>Replace <strong>oldurl.com<\/strong> with your current WordPress address and <strong>newurl.com<\/strong> with your new WordPress address.<\/p><p><div><p class=\"important\"><strong>Important!<\/strong> Your table prefix might not be <strong>wp_<\/strong>. See the correct table prefix on the left panel of phpMyAdmin, and update the SQL query.<\/p><\/div>\n\n\n\n<\/p><li>Press&nbsp;<strong>Go. <\/strong>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.<br><img decoding=\"async\" class=\"aligncenter wp-image-22877 size-full\" src=\"\/tutorials\/wp-content\/uploads\/sites\/2\/2016\/06\/sucess-messages-after-changing-wordpress-urls-e1573617184477.png\" alt=\"This image shows that you have successfully changed your WordPress URLs\" width=\"1613\" height=\"612\" srcset=\"https:\/\/www.hostinger.com\/ph\/tutorials\/wp-content\/uploads\/sites\/44\/2016\/06\/sucess-messages-after-changing-wordpress-urls-e1573617184477.png 1613w, https:\/\/www.hostinger.com\/ph\/tutorials\/wp-content\/uploads\/sites\/44\/2016\/06\/sucess-messages-after-changing-wordpress-urls-e1573617184477-150x57.png 150w, https:\/\/www.hostinger.com\/ph\/tutorials\/wp-content\/uploads\/sites\/44\/2016\/06\/sucess-messages-after-changing-wordpress-urls-e1573617184477-300x114.png 300w, https:\/\/www.hostinger.com\/ph\/tutorials\/wp-content\/uploads\/sites\/44\/2016\/06\/sucess-messages-after-changing-wordpress-urls-e1573617184477-768x291.png 768w, https:\/\/www.hostinger.com\/ph\/tutorials\/wp-content\/uploads\/sites\/44\/2016\/06\/sucess-messages-after-changing-wordpress-urls-e1573617184477-1024x389.png 1024w\" sizes=\"(max-width: 1613px) 100vw, 1613px\" \/><\/li><li>The last thing we need to do is verify the changes. Open the <strong>wp_options<\/strong> table and check the <strong>option_value<\/strong> of <strong>siteurl<\/strong> and <strong>home. <\/strong>You should see your new URL.<br><img decoding=\"async\" class=\"aligncenter wp-image-22879 size-full\" src=\"\/tutorials\/wp-content\/uploads\/sites\/2\/2016\/06\/new-urls-in-wp-options-table.png\" alt=\"The new URLs in wp_options table\" width=\"1316\" height=\"626\" srcset=\"https:\/\/www.hostinger.com\/ph\/tutorials\/wp-content\/uploads\/sites\/44\/2016\/06\/new-urls-in-wp-options-table.png 1316w, https:\/\/www.hostinger.com\/ph\/tutorials\/wp-content\/uploads\/sites\/44\/2016\/06\/new-urls-in-wp-options-table-150x71.png 150w, https:\/\/www.hostinger.com\/ph\/tutorials\/wp-content\/uploads\/sites\/44\/2016\/06\/new-urls-in-wp-options-table-300x143.png 300w, https:\/\/www.hostinger.com\/ph\/tutorials\/wp-content\/uploads\/sites\/44\/2016\/06\/new-urls-in-wp-options-table-768x365.png 768w, https:\/\/www.hostinger.com\/ph\/tutorials\/wp-content\/uploads\/sites\/44\/2016\/06\/new-urls-in-wp-options-table-1024x487.png 1024w\" sizes=\"(max-width: 1316px) 100vw, 1316px\" \/><\/li><p><span style=\"font-weight: 400\">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.<\/span><\/p><h2 class=\"wp-block-heading\" id=\"h-conclusion\">Conclusion<\/h2><p><span style=\"font-weight: 400\">We have just learned how to change WordPress URLs in the MySQL database using phpMyAdmin. <\/span><\/p><p>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.<\/p><p>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!<\/p><p>\n<div class=\"protip\">\n                    <h4 class=\"title\">Learn Other Advanced WordPress Techniques<\/h4>\n                    <p><a href=\"\/ph\/tutorials\/create-default-wordpress-htaccess-file\">How to Locate and Create the WordPress .htaccess File on cPanel and hPanel<\/a><br>\n<a href=\"\/ph\/tutorials\/how-to-perform-search-and-replace-in-wordpress-database\/\">How to Perform a WordPress Search and Replace in the Database<\/a><br>\n<a href=\"\/ph\/tutorials\/wordpress-wp_query\">Basics of Using WordPress WP_Query + Examples With Code<\/a><br>\n<a href=\"\/ph\/tutorials\/how-to-use-xampp-wordpress\/\">How to Use XAMPP to Set Up a Local WordPress Site<\/a><br>\n<a href=\"\/ph\/tutorials\/speed-up-wordpress\">How to Speed Up a WordPress Site<\/a><\/p>\n                <\/div>&ldquo;<\/p><h2 class=\"wp-block-heading\" id=\"h-change-wordpress-url-in-database-faq\">Change WordPress URL in Database FAQ<\/h2><p>Once you know how to change WordPress URLs in your database, here are some frequently asked questions about the topic.<\/p><div class=\"schema-faq wp-block-yoast-faq-block\"><div class=\"schema-faq-section\" id=\"faq-question-1675073811740\"><h3 class=\"schema-faq-question\">How Do I Change the URL in MySQL?<\/h3> <p class=\"schema-faq-answer\">Changing the URL in MySQL requires some technical knowledge. First, you&rsquo;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.<\/p> <\/div> <div class=\"schema-faq-section\" id=\"faq-question-1675073891655\"><h3 class=\"schema-faq-question\">How Do I Connect My WordPress Website to MySQL Database?<\/h3> <p class=\"schema-faq-answer\">First, log in to your hosting account and launch <strong>phpMyAdmin<\/strong>. There, click on the <strong>Import <\/strong>link from the top menu and then the<strong> Choose file<\/strong> button. Select your WordPress database to connect the two.<\/p> <\/div> <div class=\"schema-faq-section\" id=\"faq-question-1675073929222\"><h3 class=\"schema-faq-question\">Can I Change My WordPress Database Name?<\/h3> <p class=\"schema-faq-answer\">Yes, it is possible to change your WordPress database name. Once you access the phpMyAdmin from your hosting account, click on the <strong>Operations<\/strong> tab. Under <strong>Rename database<\/strong> to, enter the new name and click <strong>Go<\/strong>.<\/p> <\/div> <\/div>\n","protected":false},"excerpt":{"rendered":"<p>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&rsquo;s domain and URL. Not only will your site address change, but all internal links stored [&#8230;]<\/p>\n<p><a class=\"btn btn-secondary understrap-read-more-link\" href=\"\/ph\/tutorials\/how-to-change-wordpress-urls-in-mysql-database\">Read More&#8230;<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"rank_math_title":"How to Change WordPress URL in Database Using phpMyAdmin","rank_math_description":"Looking for a way to change your site URL? Follow our step-by-step guide and learn how to change WordPress URL in database with phpMyAdmin.","rank_math_focus_keyword":"change wordpress url in database","footnotes":""},"categories":[22632],"tags":[],"class_list":["post-534","post","type-post","status-publish","format-standard","hentry","category-wordpress"],"hreflangs":[{"locale":"en-US","link":"https:\/\/www.hostinger.com\/tutorials\/how-to-change-wordpress-urls-in-mysql-database","default":0},{"locale":"pt-BR","link":"https:\/\/www.hostinger.com\/br\/tutoriais\/como-mudar-url-do-wordpress-no-banco-de-dados","default":0},{"locale":"fr-FR","link":"https:\/\/www.hostinger.com\/fr\/tutoriels\/modifier-url-wordpress-dans-base-de-donnees","default":0},{"locale":"es-ES","link":"https:\/\/www.hostinger.com\/es\/tutoriales\/que-es-nslookup-5","default":0},{"locale":"id-ID","link":"https:\/\/www.hostinger.com\/id\/tutorial\/cara-mengganti-domain-wordpress","default":0},{"locale":"en-UK","link":"https:\/\/www.hostinger.com\/uk\/tutorials\/how-to-change-wordpress-urls-in-mysql-database","default":0},{"locale":"en-MY","link":"https:\/\/www.hostinger.com\/my\/tutorials\/how-to-change-wordpress-urls-in-mysql-database","default":0},{"locale":"en-PH","link":"https:\/\/www.hostinger.com\/ph\/tutorials\/how-to-change-wordpress-urls-in-mysql-database","default":0},{"locale":"en-IN","link":"https:\/\/www.hostinger.com\/in\/tutorials\/how-to-change-wordpress-urls-in-mysql-database","default":0},{"locale":"en-CA","link":"https:\/\/www.hostinger.com\/ca\/tutorials\/how-to-change-wordpress-urls-in-mysql-database","default":0},{"locale":"es-AR","link":"https:\/\/www.hostinger.com\/ar\/tutoriales\/como-cambiar-la-url-de-wordpress","default":0},{"locale":"es-MX","link":"https:\/\/www.hostinger.com\/mx\/tutoriales\/que-es-nslookup-5","default":0},{"locale":"es-CO","link":"https:\/\/www.hostinger.com\/co\/tutoriales\/que-es-nslookup-5","default":0},{"locale":"pt-PT","link":"https:\/\/www.hostinger.com\/pt\/tutoriais\/como-mudar-url-do-wordpress-no-banco-de-dados","default":0},{"locale":"en-AU","link":"https:\/\/www.hostinger.com\/au\/tutorials\/how-to-change-wordpress-urls-in-mysql-database","default":0},{"locale":"en-NG","link":"https:\/\/www.hostinger.com\/ng\/tutorials\/how-to-change-wordpress-urls-in-mysql-database","default":0}],"_links":{"self":[{"href":"https:\/\/www.hostinger.com\/ph\/tutorials\/wp-json\/wp\/v2\/posts\/534","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.hostinger.com\/ph\/tutorials\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hostinger.com\/ph\/tutorials\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/ph\/tutorials\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/ph\/tutorials\/wp-json\/wp\/v2\/comments?post=534"}],"version-history":[{"count":34,"href":"https:\/\/www.hostinger.com\/ph\/tutorials\/wp-json\/wp\/v2\/posts\/534\/revisions"}],"predecessor-version":[{"id":126262,"href":"https:\/\/www.hostinger.com\/ph\/tutorials\/wp-json\/wp\/v2\/posts\/534\/revisions\/126262"}],"wp:attachment":[{"href":"https:\/\/www.hostinger.com\/ph\/tutorials\/wp-json\/wp\/v2\/media?parent=534"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hostinger.com\/ph\/tutorials\/wp-json\/wp\/v2\/categories?post=534"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hostinger.com\/ph\/tutorials\/wp-json\/wp\/v2\/tags?post=534"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}