{"id":905,"date":"2013-05-12T01:14:37","date_gmt":"2013-05-12T09:14:37","guid":{"rendered":"http:\/\/blog.portnumber53.com\/?p=905"},"modified":"2013-05-12T01:14:37","modified_gmt":"2013-05-12T09:14:37","slug":"mysql-dumping-single-database-table-and-restoring","status":"publish","type":"post","link":"https:\/\/blog.portnumber53.com\/index.php\/2013\/05\/12\/mysql-dumping-single-database-table-and-restoring\/","title":{"rendered":"mysql: Dumping single database table and restoring"},"content":{"rendered":"<p>Sometimes you need to dump a single table from a mysql table and restore it somewhere else. Here&#39;s what you need:<\/p>\n<p>&nbsp;<\/p>\n<p>1. Dump the table (compress it so it will take shorter to transfer over the network)<\/p>\n<p>&nbsp;<\/p>\n<p>mysqldump -h &lt;HOST&gt; -u &lt;USERNAME&gt; -p &lt;DATABASE&gt; &lt;TABLE&gt; | gzip &gt; &lt;DUMP_FILENAME&gt;.gz<\/p>\n<p>&nbsp;<\/p>\n<p>HOST is the hostname or IP address of the mysql server<\/p>\n<p>USERNAME is a user with access to the database and table<\/p>\n<p>DATABASE and TABLE are self explanatory<\/p>\n<p>DUMP_FILE is the name you want for the file containing the compressed dump<\/p>\n<p>&nbsp;<\/p>\n<p>2. Transfer the file where you need it to be, with &quot;cp&quot; or &quot;scp&quot;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>cp &lt;DUMP_FILENAME&gt;.hz &nbsp;folder\/new_name<\/p>\n<div>\n<p>scp &lt;DUMP_FILENAME&gt;.hz &nbsp;user@machine:folder<\/p>\n<div>&nbsp;<\/div>\n<\/div>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Sometimes you need to dump a single table from a mysql table and restore it somewhere else. Here&#39;s what you need: &nbsp; 1. Dump the table (compress it so it will take shorter to transfer over the network) &nbsp; mysqldump -h &lt;HOST&gt; -u &lt;USERNAME&gt; -p &lt;DATABASE&gt; &lt;TABLE&gt; | gzip &gt;&#8230; <a class=\"continue-reading-link\" href=\"https:\/\/blog.portnumber53.com\/index.php\/2013\/05\/12\/mysql-dumping-single-database-table-and-restoring\/\"> Continue reading <span class=\"meta-nav\">&rarr; <\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4,14],"tags":[101,124,170,253,294,342],"class_list":["post-905","post","type-post","status-publish","format-standard","hentry","category-development","category-linux","tag-database","tag-dump","tag-gzip","tag-mysql","tag-restore","tag-transfer"],"_links":{"self":[{"href":"https:\/\/blog.portnumber53.com\/index.php\/wp-json\/wp\/v2\/posts\/905","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.portnumber53.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.portnumber53.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.portnumber53.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.portnumber53.com\/index.php\/wp-json\/wp\/v2\/comments?post=905"}],"version-history":[{"count":0,"href":"https:\/\/blog.portnumber53.com\/index.php\/wp-json\/wp\/v2\/posts\/905\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog.portnumber53.com\/index.php\/wp-json\/wp\/v2\/media?parent=905"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.portnumber53.com\/index.php\/wp-json\/wp\/v2\/categories?post=905"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.portnumber53.com\/index.php\/wp-json\/wp\/v2\/tags?post=905"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}