{"id":364,"date":"2013-09-19T13:10:35","date_gmt":"2013-09-19T13:10:35","guid":{"rendered":"http:\/\/blog.law.gmu.edu\/webservices\/?p=364"},"modified":"2013-09-19T13:10:35","modified_gmt":"2013-09-19T13:10:35","slug":"backup-and-restore-mysql-via-mysqldump","status":"publish","type":"post","link":"https:\/\/sls.gmu.edu\/web\/2013\/09\/19\/backup-and-restore-mysql-via-mysqldump\/","title":{"rendered":"Backup and Restore MySQL via MySQLdump"},"content":{"rendered":"<p><strong>To backup:<\/strong><\/p>\n<p># mysqldump -u root -p[password] database_name &gt; database_name_backup.sql<\/p>\n<p>[password] should be placed immediately after -p. For example: -p<strong>mypassword<\/strong>. database_name_backup.sql would be created in the root directory.<\/p>\n<p><strong>To restore:<\/strong><\/p>\n<ol>\n<li>Create an appropriately named database on the target machine<\/li>\n<li>Load the file using the mysql command:<br \/>\n# mysql -u [uname] -p[pass] [db_to_restore] &lt; [backupfile.sql]\n<\/li>\n<\/ol>\n<p>To restore a database that already exists, use mysqlimport command:<br \/>\nmysqlimport -u [uname] -p[pass] [dbname] [backupfile.sql]<\/p>\n<p><strong>Source<\/strong>: <a href=\"https:\/\/webcheatsheet.com\/SQL\/mysql_backup_restore.php\">How to Back Up and Restore a MySQL Database<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>To backup: # mysqldump -u root -p[password] database_name &gt; database_name_backup.sql [password] should be placed immediately after -p. For example: -pmypassword. database_name_backup.sql would be created in the root directory. To restore: Create an appropriately named database on the target machine Load the file using the mysql command: # mysql -u [uname] -p[pass] [db_to_restore] &lt; [backupfile.sql] To &hellip; <a href=\"https:\/\/sls.gmu.edu\/web\/2013\/09\/19\/backup-and-restore-mysql-via-mysqldump\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Backup and Restore MySQL via MySQLdump&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false,"footnotes":""},"categories":[5],"tags":[23],"class_list":["post-364","post","type-post","status-publish","format-standard","hentry","category-command-lines","tag-mysql"],"_links":{"self":[{"href":"https:\/\/sls.gmu.edu\/web\/wp-json\/wp\/v2\/posts\/364","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/sls.gmu.edu\/web\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sls.gmu.edu\/web\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sls.gmu.edu\/web\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/sls.gmu.edu\/web\/wp-json\/wp\/v2\/comments?post=364"}],"version-history":[{"count":0,"href":"https:\/\/sls.gmu.edu\/web\/wp-json\/wp\/v2\/posts\/364\/revisions"}],"wp:attachment":[{"href":"https:\/\/sls.gmu.edu\/web\/wp-json\/wp\/v2\/media?parent=364"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sls.gmu.edu\/web\/wp-json\/wp\/v2\/categories?post=364"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sls.gmu.edu\/web\/wp-json\/wp\/v2\/tags?post=364"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}