{"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\nif 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\nThen you can install p7zip with home brew.<\/p>\n\n\n\n
brew install p7zip<\/code><\/pre>\n\n\n\nFinally,\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\nYay, 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