{"id":4017,"date":"2020-03-11T10:22:25","date_gmt":"2020-03-11T10:22:25","guid":{"rendered":"https:\/\/litextension.com\/faq\/docs\/userguide-demo\/how-do-i-restore-a-mysql-from-database-dump\/"},"modified":"2024-12-31T02:13:47","modified_gmt":"2024-12-31T02:13:47","slug":"how-do-i-restore-a-mysql-from-database-dump","status":"publish","type":"docs","link":"https:\/\/litextension.com\/faq\/docs\/migration-process\/migration-preparation\/how-do-i-restore-a-mysql-from-database-dump\/","title":{"rendered":"How do I restore a MySQL from database dump?"},"content":{"rendered":"\n<p>If you\u2019re migrating to a new server, restoring a MySQL database from a dump allows you to replicate your website or application\u2019s data on the new environment. This is crucial for preserving functionality, maintaining data integrity, and minimizing downtime during the migration process. Here\u2019s how to restore your MySQL database in 2 quick and effective methods:<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>1. Using\u00a0Command-Line<\/strong><\/h2>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Step 1: Create a New Database<\/strong><\/h3>\n\n\n\n<p>Log into the system hosting the database and use MySQL to create a new database. Then, name the database exactly as the one you lost. <\/p>\n\n\n\n<p>This step prepares an empty database where the dump file will import the data, as the dump file already contains the commands needed to rebuild the database structure and content.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Step 2: Restore MySQL Dump<\/strong><\/h3>\n\n\n\n<p>To restore the database, run the following command:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>mysql -u &#91;user] -p &#91;database_name] &lt; &#91;filename].sql<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Replace <code>[user]<\/code> with your MySQL username.<\/li>\n\n\n\n<li>Replace <code>[database_name]<\/code> with the name of your database.<\/li>\n\n\n\n<li>Replace <code>[filename]<\/code> with the name of the dump file you\u2019re restoring.<\/li>\n<\/ul>\n\n\n\n<p>Make sure to include&nbsp;<strong>[database_name]<\/strong>&nbsp;and&nbsp;<strong>[filename<\/strong>] in the path.<\/p>\n\n\n\n<p>It\u2019s likely that on the host machine,\u00a0<strong>[database_name]<\/strong>\u00a0can be in a root directory, so you may not need to add the path. Please make sure that you specify the exact path for the dump file you\u2019re restoring, including the server name (if needed).<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>2.&nbsp;Using phpMyAdmin<\/strong><\/h2>\n\n\n\n<p>If you\u2019re running phpMyAdmin backing up,\u00a0restoring your MySQL database\u00a0is simple.\u00a0 In phpMyAdmin, the\u00a0Import\u00a0tool is used to restore a database.<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Open phpMyAdmin and navigate to the &#8220;Import&#8221; tool on the menu at the top.<\/li>\n\n\n\n<li>In the &#8220;File to Import&#8221; section, click the &#8220;Choose File&#8221; button.<\/li>\n\n\n\n<li>Use the dialog box to locate and select the dump file you want to restore.<\/li>\n\n\n\n<li>Leave the settings at their default values unless your backup was created with specific options that require adjustment.<\/li>\n\n\n\n<li>Click &#8220;Go&#8221; to start the restoration process.<\/li>\n<\/ol>\n\n\n\n<p>In case you have any other questions, please reach out to us via:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/litextension.zendesk.com\/hc\/en-us\/signin?return_to=https%3A%2F%2Flitextension.zendesk.com%2Fhc%2Fen-us%2Frequests\" target=\"_blank\" rel=\"noopener\">Ticket system<\/a> (highly recommended)<\/li>\n\n\n\n<li>Email us at <a href=\"mailto:contact@litextension.com\" target=\"_blank\" rel=\"noopener\">contact@litextension.com<\/a><\/li>\n<\/ul>\n","protected":false},"author":1,"featured_media":0,"parent":6184,"menu_order":13,"comment_status":"open","ping_status":"closed","template":"","meta":{"footnotes":""},"doc_tag":[1083,3613,3612,3614,3615],"class_list":["post-4017","docs","type-docs","status-publish","hentry","doc_tag-database-dump","doc_tag-mysql-dump","doc_tag-phpmyadmin","doc_tag-restore","doc_tag-restore-a-mysql"],"comment_count":0,"_links":{"self":[{"href":"https:\/\/litextension.com\/faq\/wp-json\/wp\/v2\/docs\/4017","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/litextension.com\/faq\/wp-json\/wp\/v2\/docs"}],"about":[{"href":"https:\/\/litextension.com\/faq\/wp-json\/wp\/v2\/types\/docs"}],"author":[{"embeddable":true,"href":"https:\/\/litextension.com\/faq\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/litextension.com\/faq\/wp-json\/wp\/v2\/comments?post=4017"}],"version-history":[{"count":7,"href":"https:\/\/litextension.com\/faq\/wp-json\/wp\/v2\/docs\/4017\/revisions"}],"predecessor-version":[{"id":7066,"href":"https:\/\/litextension.com\/faq\/wp-json\/wp\/v2\/docs\/4017\/revisions\/7066"}],"up":[{"embeddable":true,"href":"https:\/\/litextension.com\/faq\/wp-json\/wp\/v2\/docs\/6184"}],"next":[{"title":"How to set permission for root folder?","link":"https:\/\/litextension.com\/faq\/docs\/migration-process\/migration-preparation\/set-permissions-for-root-folder-litextension-shopping-cart-migration\/","href":"https:\/\/litextension.com\/faq\/wp-json\/wp\/v2\/docs\/288"}],"prev":[{"title":"What is Basic Authentication?","link":"https:\/\/litextension.com\/faq\/docs\/migration-process\/migration-preparation\/what-is-basic-authentication\/","href":"https:\/\/litextension.com\/faq\/wp-json\/wp\/v2\/docs\/5746"}],"wp:attachment":[{"href":"https:\/\/litextension.com\/faq\/wp-json\/wp\/v2\/media?parent=4017"}],"wp:term":[{"taxonomy":"doc_tag","embeddable":true,"href":"https:\/\/litextension.com\/faq\/wp-json\/wp\/v2\/doc_tag?post=4017"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}