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 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 |
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
Came back to this yet again to figure out how to do this.
I thought I would add this method to obtain the estimated progress and completion time:
Install
pv
. On macOS, you can dobrew install pv
.pv dump.sql.tar.gz | tar xO | mysql -u $user -p $database
And you'll get a real-time output like this: