Last active
May 4, 2023 06:00
-
-
Save infusion/492418723b6736784af1 to your computer and use it in GitHub Desktop.
Import a tar.gz file to MySQL
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tar xOf dump.sql.tar.gz | mysql -u $user -p $database |
Thanks, maybe this changed somewhere in time, I learned the options once and never looked it again
👍 I hear that! Really useful so thanks for posting.
Simple and effective:
zcat dump.sql.tar.gz | mysql -u $user -p $database
zcat is cat equivalent that also decompresses archive.
On OSX zcat might not work like that, you need zcat < dump.sql.tar.gz | mysql -u $user -p $database
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I don't think you need the
z
when extracting: