{"id":4104,"date":"2015-01-16T10:53:57","date_gmt":"2015-01-16T02:53:57","guid":{"rendered":"http:\/\/rmohan.com\/?p=4104"},"modified":"2015-01-16T10:53:57","modified_gmt":"2015-01-16T02:53:57","slug":"how-do-i-export-and-import-a-mysql-database","status":"publish","type":"post","link":"https:\/\/mohan.sg\/?p=4104","title":{"rendered":"How do I Export and Import a MySQL Database ?"},"content":{"rendered":"<p>There are times during migrations, database restores etc that you will need to export and import your MySQL database. Below shows you the commands required to achieved this.<\/p>\n<p><strong>Note<\/strong><span class=\"Apple-converted-space\">\u00a0<\/span>: This article is meant as a reference point rather then a full blown article.<\/p>\n<h2>EXPORT<\/h2>\n<pre class=\"prettyprint prettyprinted\"><span class=\"pln\">mysqldump <\/span><span class=\"pun\">-<\/span><span class=\"pln\">u root <\/span><span class=\"pun\">-<\/span><span class=\"pln\">p <\/span><span class=\"pun\">{<\/span><span class=\"pln\">database<\/span><span class=\"pun\">}<\/span> <span class=\"pun\">&gt;<\/span><span class=\"pln\"> db<\/span><span class=\"pun\">.<\/span><span class=\"pln\">sql<\/span><\/pre>\n<h2>IMPORT<\/h2>\n<pre class=\"prettyprint prettyprinted\"><span class=\"pln\">mysql <\/span><span class=\"pun\">-<\/span><span class=\"pln\">u root <\/span><span class=\"pun\">-<\/span><span class=\"pln\">p <\/span><span class=\"pun\">-<\/span><span class=\"pln\">h <\/span><span class=\"lit\">127.0<\/span><span class=\"pun\">.<\/span><span class=\"lit\">0.1<\/span> <span class=\"pun\">{<\/span><span class=\"pln\">database<\/span><span class=\"pun\">}<\/span> <span class=\"pun\">&lt;<\/span><span class=\"pln\"> db<\/span><span class=\"pun\">.<\/span><span class=\"pln\">sql<\/span><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>There are times during migrations, database restores etc that you will need to export and import your MySQL database. Below shows you the commands required to achieved this.<\/p>\n<p>Note : This article is meant as a reference point rather then a full blown article.<\/p>\n<p> EXPORT mysqldump -u root -p {database} &gt; db.sql IMPORT mysql -u [&#8230;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[],"_links":{"self":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/4104"}],"collection":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=4104"}],"version-history":[{"count":1,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/4104\/revisions"}],"predecessor-version":[{"id":4105,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/4104\/revisions\/4105"}],"wp:attachment":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=4104"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=4104"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=4104"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}