{"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-04-24T05:46:22","modified_gmt":"2026-04-24T05:46:22","slug":"how-to-change-wordpress-urls-in-mysql-database","status":"publish","type":"post","link":"\/ng\/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":"<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\">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=\"\/ng\/tutorials\/what-is-mysql\">MySQL<\/a> database. If you have multiple databases and need to confirm which one belongs to your WordPress site, check it in hPanel.<\/p><p>Open hPanel and navigate to <strong>WordPress &rarr; Overview<\/strong>. The database name is listed in the <strong>Database <\/strong>section.<\/p><div class=\"wp-block-image\"><figure data-wp-context='{\"imageId\":\"69f35873e5e7a\"}' data-wp-interactive=\"core\/image\" class=\"aligncenter size-large wp-lightbox-container\"><img decoding=\"async\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-on-async--load=\"callbacks.setButtonStyles\" data-wp-on-async-window--resize=\"callbacks.setButtonStyles\" src=\"https:\/\/www.hostinger.com\/tutorials\/wp-content\/uploads\/sites\/2\/2019\/11\/hpanel-websites-wordpress-overview-database-highlighted-1024x655.png\" alt=\"The Database section in the WordPress Overview page of hPanel\" class=\"wp-image-146272\"><button class=\"lightbox-trigger\" type=\"button\" aria-haspopup=\"dialog\" aria-label=\"Enlarge\" data-wp-init=\"callbacks.initTriggerButton\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-style--right=\"state.imageButtonRight\" data-wp-style--top=\"state.imageButtonTop\">\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewbox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\"><\/path>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure><\/div><p>You can also find the database name in the <a href=\"\/ng\/tutorials\/wp-config-php\">wp-config.php<\/a> file. Open <strong>File Manager<\/strong> from hPanel, locate <strong>wp-config.php<\/strong> in your root directory, and search for <strong>DB_NAME<\/strong>. The value next for parameter is your database name.<\/p><ol start=\"3\" class=\"wp-block-list\"><\/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 loading=\"lazy\" decoding=\"async\" width=\"954\" height=\"632\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2023\/03\/filemanager-publichtml-wpconfig-dbname-1.png\/public\" alt=\"wp-config file, database username highlighted\" class=\"wp-image-80705\" srcset=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2023\/03\/filemanager-publichtml-wpconfig-dbname-1.png\/w=954,fit=scale-down 954w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2023\/03\/filemanager-publichtml-wpconfig-dbname-1.png\/w=300,fit=scale-down 300w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2023\/03\/filemanager-publichtml-wpconfig-dbname-1.png\/w=150,fit=scale-down 150w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2023\/03\/filemanager-publichtml-wpconfig-dbname-1.png\/w=768,fit=scale-down 768w\" sizes=\"auto, (max-width: 954px) 100vw, 954px\" \/><\/a><\/figure><?xml encoding=\"utf-8\" ?><figure class=\"wp-block-image size-large\"><a class=\"hgr-tutorials-cta hgr-tutorials-cta-wordpress-hosting\" href=\"\/ng\/wordpress-hosting\" target=\"_blank\" rel=\"noreferrer noopener\"><img loading=\"lazy\" decoding=\"async\" width=\"2048\" height=\"600\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2024\/06\/New-WP_in-text-banner.png\/public\" alt=\"\" class=\"wp-image-111781\" srcset=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2024\/06\/New-WP_in-text-banner.png\/w=2048,fit=scale-down 2048w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2024\/06\/New-WP_in-text-banner.png\/w=300,fit=scale-down 300w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2024\/06\/New-WP_in-text-banner.png\/w=1024,fit=scale-down 1024w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2024\/06\/New-WP_in-text-banner.png\/w=150,fit=scale-down 150w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2024\/06\/New-WP_in-text-banner.png\/w=768,fit=scale-down 768w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2024\/06\/New-WP_in-text-banner.png\/w=1536,fit=scale-down 1536w\" sizes=\"auto, (max-width: 2048px) 100vw, 2048px\" \/><\/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 loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"325\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2019\/11\/Screenshot-2023-01-26-at-17.46.09.png\/public\" alt=\"phpMyAdmin run SQL query\/queries on database\" class=\"wp-image-76353\" srcset=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2019\/11\/Screenshot-2023-01-26-at-17.46.09.png\/w=1024,fit=scale-down 1024w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2019\/11\/Screenshot-2023-01-26-at-17.46.09.png\/w=300,fit=scale-down 300w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2019\/11\/Screenshot-2023-01-26-at-17.46.09.png\/w=150,fit=scale-down 150w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2019\/11\/Screenshot-2023-01-26-at-17.46.09.png\/w=768,fit=scale-down 768w\" sizes=\"auto, (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 loading=\"lazy\" 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:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2016\/06\/sucess-messages-after-changing-wordpress-urls-e1573617184477.png\/w=1613,fit=scale-down 1613w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2016\/06\/sucess-messages-after-changing-wordpress-urls-e1573617184477.png\/w=150,fit=scale-down 150w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2016\/06\/sucess-messages-after-changing-wordpress-urls-e1573617184477.png\/w=300,fit=scale-down 300w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2016\/06\/sucess-messages-after-changing-wordpress-urls-e1573617184477.png\/w=768,fit=scale-down 768w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2016\/06\/sucess-messages-after-changing-wordpress-urls-e1573617184477.png\/w=1024,fit=scale-down 1024w\" sizes=\"auto, (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 loading=\"lazy\" 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:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2016\/06\/new-urls-in-wp-options-table.png\/w=1316,fit=scale-down 1316w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2016\/06\/new-urls-in-wp-options-table.png\/w=150,fit=scale-down 150w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2016\/06\/new-urls-in-wp-options-table.png\/w=300,fit=scale-down 300w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2016\/06\/new-urls-in-wp-options-table.png\/w=768,fit=scale-down 768w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2016\/06\/new-urls-in-wp-options-table.png\/w=1024,fit=scale-down 1024w\" sizes=\"auto, (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=\"\/ng\/tutorials\/create-default-wordpress-htaccess-file\">How to Locate and Create the WordPress .htaccess File on cPanel and hPanel<\/a><br>\n<a href=\"\/ng\/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=\"\/ng\/tutorials\/wordpress-wp_query\">Basics of Using WordPress WP_Query + Examples With Code<\/a><br>\n<a href=\"\/ng\/tutorials\/how-to-use-xampp-wordpress\/\">How to Use XAMPP to Set Up a Local WordPress Site<\/a><br>\n<a href=\"\/ng\/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=\"\/ng\/tutorials\/how-to-change-wordpress-urls-in-mysql-database\">Read More&#8230;<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","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":[22637],"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\/ng\/tutorials\/wp-json\/wp\/v2\/posts\/534","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.hostinger.com\/ng\/tutorials\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hostinger.com\/ng\/tutorials\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/ng\/tutorials\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/ng\/tutorials\/wp-json\/wp\/v2\/comments?post=534"}],"version-history":[{"count":38,"href":"https:\/\/www.hostinger.com\/ng\/tutorials\/wp-json\/wp\/v2\/posts\/534\/revisions"}],"predecessor-version":[{"id":146409,"href":"https:\/\/www.hostinger.com\/ng\/tutorials\/wp-json\/wp\/v2\/posts\/534\/revisions\/146409"}],"wp:attachment":[{"href":"https:\/\/www.hostinger.com\/ng\/tutorials\/wp-json\/wp\/v2\/media?parent=534"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hostinger.com\/ng\/tutorials\/wp-json\/wp\/v2\/categories?post=534"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hostinger.com\/ng\/tutorials\/wp-json\/wp\/v2\/tags?post=534"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}