{"id":1574,"date":"2013-02-02T08:34:18","date_gmt":"2013-02-02T16:34:18","guid":{"rendered":"http:\/\/www.wellgolly.com\/?p=1574"},"modified":"2015-04-07T08:55:50","modified_gmt":"2015-04-07T15:55:50","slug":"things-i-cant-remember-import-sql-file-to-mysql","status":"publish","type":"post","link":"https:\/\/www.wellgolly.com\/?p=1574","title":{"rendered":"Things I can\u2019t remember\u2014import SQL file to MySQL"},"content":{"rendered":"<p>I usually use phpMyAdmin to manipulate tables in my databases but sometimes the file I want to import is too big. In that case I use the command line to import the file. <\/p>\n<p>In this line, I replace a database with formatted sql statements that I&#8217;ve edited by hand. the -p flag without an argument will prompt for the root password of the MySQL installation.<\/p>\n<p><code class=\"\u2019smaller\u2019 preserve-code-formatting\">mysql -u root -p original_database &lt; \/Users\/username\/Desktop\/edited_data.sql<\/code><\/p>\n<p>Here I want to replace the entire MySQL database with the backup. I do this on my backup machine from time to time using the nightly My backup. This example shows the password after the flag.<\/p>\n<p><code class=\"\u2019smaller\u2019 preserve-code-formatting\">mysql -u root -pYourPassword &lt; mysql-backup.sql<\/code><\/p>\n","protected":false},"excerpt":{"rendered":"<p>I usually use phpMyAdmin to manipulate tables in my databases but sometimes the file I want to import is too big. In that case I use the command line to import the file. In this line, I replace a database with formatted sql statements that I&#8217;ve edited by hand. the -p flag without an argument &hellip; <a href=\"https:\/\/www.wellgolly.com\/?p=1574\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Things I can\u2019t remember\u2014import SQL file to MySQL<\/span><\/a><\/p>\n","protected":false},"author":6,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[27],"tags":[],"class_list":["post-1574","post","type-post","status-publish","format-standard","hentry","category-mysql"],"_links":{"self":[{"href":"https:\/\/www.wellgolly.com\/index.php?rest_route=\/wp\/v2\/posts\/1574","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wellgolly.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wellgolly.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wellgolly.com\/index.php?rest_route=\/wp\/v2\/users\/6"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wellgolly.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1574"}],"version-history":[{"count":0,"href":"https:\/\/www.wellgolly.com\/index.php?rest_route=\/wp\/v2\/posts\/1574\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wellgolly.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1574"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wellgolly.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1574"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wellgolly.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1574"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}