{"id":4565,"date":"2025-12-17T17:50:57","date_gmt":"2025-12-17T23:50:57","guid":{"rendered":"https:\/\/racmanuel.dev\/?post_type=tools&#038;p=4565"},"modified":"2025-12-18T09:16:34","modified_gmt":"2025-12-18T15:16:34","slug":"sql-queries-change-wordpress-site-domain","status":"publish","type":"tools","link":"https:\/\/racmanuel.dev\/en\/tools\/sql-queries-change-wordpress-site-domain\/","title":{"rendered":"SQL Queries to Change WordPress Site\u00a0Domain"},"content":{"rendered":"<div class=\"wp-mig-wrap\" id=\"wp-mig-3720407c-5992-48d5-b641-28b124f8be50\" data-wp-mig=\"1\">\r\n\r\n\t\t\t<p class=\"wp-mig-desc\">\r\n\t\t\t\tGenerate SQL queries to update a WordPress site domain in the database. This tool helps when migrating a site to a new domain or protocol. Always back up your database before executing the generated queries.\t\t\t<\/p>\r\n\r\n\t\t\t<div class=\"wp-mig-row\">\r\n\t\t\t\t<div class=\"wp-mig-field\">\r\n\t\t\t\t\t<label for=\"wp-mig-3720407c-5992-48d5-b641-28b124f8be50-from\">\r\n\t\t\t\t\t\tFrom\t\t\t\t\t<\/label>\r\n\t\t\t\t\t<input type=\"text\" id=\"wp-mig-3720407c-5992-48d5-b641-28b124f8be50-from\" value=\"http:\/\/\"\r\n\t\t\t\t\t\tplaceholder=\"http:\/\/oldsite.com\" \/>\r\n\t\t\t\t<\/div>\r\n\r\n\t\t\t\t<div class=\"wp-mig-field\">\r\n\t\t\t\t\t<label for=\"wp-mig-3720407c-5992-48d5-b641-28b124f8be50-to\">\r\n\t\t\t\t\t\tTo\t\t\t\t\t<\/label>\r\n\t\t\t\t\t<input type=\"text\" id=\"wp-mig-3720407c-5992-48d5-b641-28b124f8be50-to\" value=\"http:\/\/\"\r\n\t\t\t\t\t\tplaceholder=\"http:\/\/newsite.com\" \/>\r\n\t\t\t\t<\/div>\r\n\r\n\t\t\t\t<div class=\"wp-mig-field wp-mig-field--prefix\">\r\n\t\t\t\t\t<label for=\"wp-mig-3720407c-5992-48d5-b641-28b124f8be50-prefix\">\r\n\t\t\t\t\t\tPrefix\t\t\t\t\t<\/label>\r\n\t\t\t\t\t<input type=\"text\" id=\"wp-mig-3720407c-5992-48d5-b641-28b124f8be50-prefix\" value=\"wp_\"\r\n\t\t\t\t\t\tplaceholder=\"wp_\" \/>\r\n\t\t\t\t<\/div>\r\n\t\t\t<\/div>\r\n\r\n\t\t\t<div class=\"wp-mig-actions\">\r\n\t\t\t\t<button class=\"wp-mig-btn\" type=\"button\" data-action=\"generate\">\r\n\t\t\t\t\tGenerate queries\t\t\t\t<\/button>\r\n\t\t\t<\/div>\r\n\r\n\t\t\t<div class=\"wp-mig-out\">\r\n\t\t\t\t<textarea readonly id=\"wp-mig-3720407c-5992-48d5-b641-28b124f8be50-out\"\r\n\t\t\t\t\tplaceholder=\"Your SQL queries will appear here...\"><\/textarea>\r\n\r\n\t\t\t\t<div class=\"wp-mig-help\">\r\n\t\t\t\t\t<strong>Tip:<\/strong>\r\n\t\t\t\t\tAlways create a database backup before running SQL queries. REPLACE() may break serialized data.\t\t\t\t<\/div>\r\n\r\n\t\t\t\t<div class=\"wp-mig-toast\" data-toast style=\"display:none;\">\r\n\t\t\t\t\tQueries copied to clipboard.\t\t\t\t<\/div>\r\n\t\t\t<\/div>\r\n\t\t<\/div>\r\n\t\t\n\n\n\n<p class=\"wp-block-paragraph\">Changing the domain of a WordPress website often requires updating URLs directly in the database. This is especially common during site migrations, server changes, or rebranding projects.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This tool helps you generate the necessary <strong>SQL queries to change a WordPress site domain<\/strong> quickly and safely, avoiding manual mistakes and saving time.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"why-use-sql-queries-to-change-a-wordpress-domain\">Why Use SQL Queries to Change a WordPress Domain?<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">When a WordPress site is moved to a new domain, the old URLs remain stored in multiple database tables. If they are not updated properly, the site may experience:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Broken internal links<\/li>\n\n\n\n<li>Missing images and assets<\/li>\n\n\n\n<li>Mixed content warnings<\/li>\n\n\n\n<li>SEO and indexing issues<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Using SQL queries allows you to update all relevant URLs at once, directly at the database level.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"what-this-wordpress-migration-sql-tool-does\">What This WordPress Migration SQL Tool Does<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">This generator creates ready-to-use <strong>MySQL SQL queries<\/strong> that help you:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Update the <code>home<\/code> and <code>siteurl<\/code> values<\/li>\n\n\n\n<li>Replace old domain URLs in post content and excerpts<\/li>\n\n\n\n<li>Update URLs stored in post meta and term meta<\/li>\n\n\n\n<li>Adjust attachment GUIDs when required<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">The tool only <strong>generates the queries<\/strong> \u2014 it does not execute them automatically \u2014 giving you full control over when and where the changes are applied.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"required-information\">Required Information<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">To generate the SQL queries, you only need to provide:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>From<\/strong> \u2013 the current WordPress site URL (old domain)<\/li>\n\n\n\n<li><strong>To<\/strong> \u2013 the new WordPress site URL<\/li>\n\n\n\n<li><strong>Prefix<\/strong> \u2013 the database table prefix used by WordPress (for example, <code>wp_<\/code>)<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Once these values are entered, the tool outputs SQL queries that can be executed in your WordPress database.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"how-to-change-a-wordpress-site-domain-using-sql\">How to Change a WordPress Site Domain Using SQL<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Follow these steps to update your WordPress domain using SQL queries:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Enter the old site domain.<\/li>\n\n\n\n<li>Enter the new site domain.<\/li>\n\n\n\n<li>Specify the database table prefix.<\/li>\n\n\n\n<li>Generate the SQL queries.<\/li>\n\n\n\n<li>Run the queries in your MySQL database.<\/li>\n<\/ol>\n\n\n\n<p class=\"wp-block-paragraph\">This approach is particularly useful when the WordPress admin dashboard is not accessible or when a site fails to load correctly after migration.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"using-sql-queries-with-wordpress-multisite\">Using SQL Queries with WordPress Multisite<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The generator also supports <strong>WordPress Multisite<\/strong> installations, with a few important considerations:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>SQL queries must be generated and executed <strong>separately for each subsite<\/strong>, using prefixes such as <code>wp_2_<\/code>, <code>wp_3_<\/code>, etc.<\/li>\n\n\n\n<li>Some multisite tables require manual updates:\n<ul class=\"wp-block-list\">\n<li><code>wp_blogs<\/code><\/li>\n\n\n\n<li><code>wp_site<\/code><\/li>\n\n\n\n<li><code>wp_sitemeta<\/code><\/li>\n<\/ul>\n<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">These tables store network-level configuration and should be handled carefully when changing domains.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"how-to-run-sql-queries-in-wordpress\">How to Run SQL Queries in WordPress<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">To apply the generated SQL queries, you need access to your WordPress MySQL database. The most common method is using <strong>phpMyAdmin<\/strong>, available through most hosting providers.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"run-sql-queries-using-phpmyadmin\">Run SQL Queries Using phpMyAdmin<\/h3>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Open phpMyAdmin from your hosting control panel.<\/li>\n\n\n\n<li>Select the WordPress database.<\/li>\n\n\n\n<li>Go to the <strong>SQL<\/strong> tab.<\/li>\n\n\n\n<li>Paste the generated SQL queries.<\/li>\n\n\n\n<li>Execute the queries.<\/li>\n<\/ol>\n\n\n\n<p class=\"wp-block-paragraph\">After execution, the WordPress site domain stored in the database will be updated.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"important-notes-before-running-sql-queries\">Important Notes Before Running SQL Queries<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Before changing a WordPress site domain using SQL, keep the following best practices in mind:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Always create a <strong>full database backup<\/strong><\/li>\n\n\n\n<li>Test the queries on a <strong>staging environment<\/strong> first<\/li>\n\n\n\n<li>Be cautious with serialized data, especially when using advanced plugins<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"a-practical-tool-for-wordpress-developers\">A Practical Tool for WordPress Developers<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">This SQL generator is built for <strong>WordPress developers and advanced users<\/strong> who need a reliable and controlled way to change a WordPress site domain using SQL queries.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Whether you are migrating a site, fixing broken URLs, or preparing a production deployment, this tool helps streamline the process.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>","protected":false},"excerpt":{"rendered":"<p>Generate SQL queries to change a WordPress site domain directly in the database. Ideal for migrations, rebranding, and fixing URLs safely.<\/p>","protected":false},"author":1,"featured_media":0,"template":"","meta":{"_acf_changed":false,"_gspb_post_css":"","_glsr_average":0,"_glsr_ranking":0,"_glsr_reviews":0},"class_list":["post-4565","tools","type-tools","status-publish","hentry"],"blocksy_meta":[],"acf":[],"_links":{"self":[{"href":"https:\/\/racmanuel.dev\/en\/wp-json\/wp\/v2\/tools\/4565","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/racmanuel.dev\/en\/wp-json\/wp\/v2\/tools"}],"about":[{"href":"https:\/\/racmanuel.dev\/en\/wp-json\/wp\/v2\/types\/tools"}],"author":[{"embeddable":true,"href":"https:\/\/racmanuel.dev\/en\/wp-json\/wp\/v2\/users\/1"}],"wp:attachment":[{"href":"https:\/\/racmanuel.dev\/en\/wp-json\/wp\/v2\/media?parent=4565"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}