{"id":136,"date":"2011-11-01T02:42:24","date_gmt":"2011-11-01T02:42:24","guid":{"rendered":"http:\/\/www.evermoredevnotes.com\/?p=136"},"modified":"2011-11-01T02:42:24","modified_gmt":"2011-11-01T02:42:24","slug":"mysql-command-line-database-copy","status":"publish","type":"post","link":"https:\/\/www.evermoretechnologies.com\/blog\/2011\/11\/mysql-command-line-database-copy\/","title":{"rendered":"MySQL Command line database copy"},"content":{"rendered":"<p>Sometimes you need to copy a database to a dev database or something.  You can usually do this through phpmyadmin, but it&#8217;s so much faster, especially with large databases, to do it through command line.<\/p>\n<p>Once ssh&#8217;d into a server with mysql on it, create a new database for the one you&#8217;re going to import data into, this can be done in phpmyadmin, or through command line.  This is how I would do it in command line:<br \/>\n[code]<br \/>\nmysql -u user -ppassword<br \/>\nmysql&gt; create database new_database;<br \/>\nexit<br \/>\n[\/code]<\/p>\n<p>Then type these two commands to the ssh terminal<br \/>\n[code]<br \/>\nmysqldump -u USER -pPASSWORD old_database &gt; filename.sql<br \/>\nmysql -u USER -pPASSWORD new_database &lt; filename.sql<br \/>\n[\/code]<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Sometimes you need to copy a database to a dev database or something. You can usually do this through phpmyadmin, but it&#8217;s so much faster, especially with large databases, to&#8230; <a href=\"https:\/\/www.evermoretechnologies.com\/blog\/2011\/11\/mysql-command-line-database-copy\/\">Read more &raquo;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[7,10],"tags":[],"_links":{"self":[{"href":"https:\/\/www.evermoretechnologies.com\/blog\/wp-json\/wp\/v2\/posts\/136"}],"collection":[{"href":"https:\/\/www.evermoretechnologies.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.evermoretechnologies.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.evermoretechnologies.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.evermoretechnologies.com\/blog\/wp-json\/wp\/v2\/comments?post=136"}],"version-history":[{"count":0,"href":"https:\/\/www.evermoretechnologies.com\/blog\/wp-json\/wp\/v2\/posts\/136\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.evermoretechnologies.com\/blog\/wp-json\/wp\/v2\/media?parent=136"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.evermoretechnologies.com\/blog\/wp-json\/wp\/v2\/categories?post=136"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.evermoretechnologies.com\/blog\/wp-json\/wp\/v2\/tags?post=136"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}