{"id":2156,"date":"2020-06-09T03:44:44","date_gmt":"2020-06-08T19:44:44","guid":{"rendered":"https:\/\/www.wesbytes.com\/guide\/?post_type=kb&#038;p=2156"},"modified":"2026-03-17T17:34:22","modified_gmt":"2026-03-17T09:34:22","slug":"backup-restore-mysqldump-commands","status":"publish","type":"kb","link":"https:\/\/www.servergigabit.com\/guide\/kb\/backup-restore-mysqldump-commands","title":{"rendered":"Mysqldump commands : 4 Steps to Backup and Restore MySQL Database Easily"},"content":{"rendered":"<h3 dir=\"ltr\"><strong>Below are mysqldump commands for backup and restore mysql database:<\/strong><\/h3>\n<p dir=\"ltr\"><b>WINDOWS<\/b><b>:<\/b><\/p>\n<p><b>Backup:<\/b><br \/>\nC:\\mysql\\bin&gt; <a href=\"https:\/\/dev.mysql.com\/doc\/refman\/8.4\/en\/mysqldump.html\" rel=\"nofollow noopener\" target=\"_blank\">mysqldump<\/a> -u username -p password\u00a0database &gt; dumbfile.sql<\/p>\n<p><b>Restore:<\/b><br \/>\nC:\\mysql\\bin&gt;mysql -u username -p password\u00a0database &lt; dumpfile.sql<\/p>\n<hr \/>\n<p dir=\"ltr\"><b>UNIX \/ LINUX<\/b><\/p>\n<p dir=\"ltr\">Method A (followed by the user database username and password)<br \/>\n=======<b><br \/>\nBackup:<\/b><br \/>\nmysqldump -u username -p password database &gt; dumbfile.sql<\/p>\n<p><b>Restore:<\/b><br \/>\nmysql -u username -p password database &lt; dumbfile.sql<\/p>\n<p>Method B (backup and restore with root access)<br \/>\n========<br \/>\n<b>Backup:<br \/>\n<\/b>mysqldump databasename &gt; dumpfile.sql<b><\/b><\/p>\n<p>Restore:<br \/>\nmysql newdatabasename &lt; dumpfile.sql<b><br \/>\n<\/b><\/p>\n<p dir=\"ltr\">Backup:<br \/>\n<b>Notes:<\/b><br \/>\n\u2013 dumbfile.sql contains SQL command for creating tables and data. (CREATE,INSERT,DROP etc.)<\/p>\n<p>If you found this guide useful during the backup. Please share it with other users going through the same process.<\/p>\n<p>&nbsp;<\/p>\n<p><em>Please refer to the following article to know more.\u00a0<\/em><br \/>\n<strong>Knowledge Base: <\/strong><a href=\"https:\/\/www.servergigabit.com\/guide\/kb\/mysql-trigger-and-view\/\">MySQL Trigger and View<\/a><\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Below are mysqldump commands for backup and restore mysql database: WINDOWS: Backup: C:\\mysql\\bin&gt; mysqldump -u username -p password\u00a0database &gt; dumbfile.sql Restore: C:\\mysql\\bin&gt;mysql -u username -p password\u00a0database &lt; dumpfile.sql UNIX \/ LINUX Method A (followed by the user database username and password) ======= Backup: mysqldump -u username -p password database &gt; dumbfile.sql Restore: mysql -u username -p password database &lt; dumbfile.sql&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"kbtopic":[51],"kbtag":[1307],"class_list":["post-2156","kb","type-kb","status-publish","hentry","kbtopic-mysql","kbtag-mysqldump"],"_links":{"self":[{"href":"https:\/\/www.servergigabit.com\/guide\/wp-json\/wp\/v2\/kb\/2156","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.servergigabit.com\/guide\/wp-json\/wp\/v2\/kb"}],"about":[{"href":"https:\/\/www.servergigabit.com\/guide\/wp-json\/wp\/v2\/types\/kb"}],"author":[{"embeddable":true,"href":"https:\/\/www.servergigabit.com\/guide\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.servergigabit.com\/guide\/wp-json\/wp\/v2\/comments?post=2156"}],"version-history":[{"count":9,"href":"https:\/\/www.servergigabit.com\/guide\/wp-json\/wp\/v2\/kb\/2156\/revisions"}],"predecessor-version":[{"id":6390,"href":"https:\/\/www.servergigabit.com\/guide\/wp-json\/wp\/v2\/kb\/2156\/revisions\/6390"}],"wp:attachment":[{"href":"https:\/\/www.servergigabit.com\/guide\/wp-json\/wp\/v2\/media?parent=2156"}],"wp:term":[{"taxonomy":"kbtopic","embeddable":true,"href":"https:\/\/www.servergigabit.com\/guide\/wp-json\/wp\/v2\/kbtopic?post=2156"},{"taxonomy":"kbtag","embeddable":true,"href":"https:\/\/www.servergigabit.com\/guide\/wp-json\/wp\/v2\/kbtag?post=2156"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}