{"id":1028,"date":"2015-07-24T12:05:30","date_gmt":"2015-07-24T12:05:30","guid":{"rendered":"http:\/\/invisiblezero.net\/?p=1028"},"modified":"2024-07-22T09:29:01","modified_gmt":"2024-07-22T09:29:01","slug":"mac-import-sql-gz-file-with-p7zip","status":"publish","type":"post","link":"http:\/\/ndthanh.com\/mac-import-sql-gz-file-with-p7zip\/","title":{"rendered":"Mac – Import sql.gz file with p7zip"},"content":{"rendered":"\n

I have been having problem with Mac extract program for gz files for a long time . and it caused me trouble to import compressed database dump from server . this is the mysql dump command i often use<\/p>\n\n\n\n

mysqldump -u USER -p --single-transaction --quick --lock-tables=false DATABASE | gzip -9 > OUTPUT.gz<\/code><\/pre>\n\n\n\n

if you’re using Mac to extract zip and import database, you may see corrupted database or broken file in some cases. today, i’m sharing with you a good method to import compressed database with sql.gz at the end.<\/p>\n\n\n\n\n\n\n\n

First, you will need homebrew on Mac, to find more information, please read this post :\u00a0Mac OS X \u2013 Homebrew, the missing package manager<\/a><\/p>\n\n\n\n

Then you can install p7zip with home brew.<\/p>\n\n\n\n

brew install p7zip<\/code><\/pre>\n\n\n\n

Finally,\u00a0use command like this to import to your database.<\/p>\n\n\n\n

7z x -so <path_to_db_dump.sql.gz> | mysql -u<your_user_name> -p<your_password> <database_name><\/code><\/pre>\n\n\n\n

Yay, it worked perfectly !! i hope you will like it \ud83d\ude42<\/p>\n","protected":false},"excerpt":{"rendered":"

I have been having problem with Mac extract program for gz files for a long time . and it caused me trouble to import compressed database dump from server . this is the mysql dump command i often use mysqldump -u USER -p –single-transaction –quick –lock-tables=false DATABASE | gzip -9 > OUTPUT.gz if you’re using…<\/p>\n

Read More<\/a><\/p>\n","protected":false},"author":1,"featured_media":1478,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[53,91],"tags":[],"aioseo_notices":[],"views":11,"_links":{"self":[{"href":"http:\/\/ndthanh.com\/wp-json\/wp\/v2\/posts\/1028"}],"collection":[{"href":"http:\/\/ndthanh.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/ndthanh.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/ndthanh.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/ndthanh.com\/wp-json\/wp\/v2\/comments?post=1028"}],"version-history":[{"count":3,"href":"http:\/\/ndthanh.com\/wp-json\/wp\/v2\/posts\/1028\/revisions"}],"predecessor-version":[{"id":1362,"href":"http:\/\/ndthanh.com\/wp-json\/wp\/v2\/posts\/1028\/revisions\/1362"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/ndthanh.com\/wp-json\/wp\/v2\/media\/1478"}],"wp:attachment":[{"href":"http:\/\/ndthanh.com\/wp-json\/wp\/v2\/media?parent=1028"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/ndthanh.com\/wp-json\/wp\/v2\/categories?post=1028"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/ndthanh.com\/wp-json\/wp\/v2\/tags?post=1028"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}