Skip to content

Instantly share code, notes, and snippets.

@infusion
Last active May 4, 2023 06:00
Show Gist options
  • Star 19 You must be signed in to star a gist
  • Fork 6 You must be signed in to fork a gist
  • Save infusion/492418723b6736784af1 to your computer and use it in GitHub Desktop.
Save infusion/492418723b6736784af1 to your computer and use it in GitHub Desktop.
Import a tar.gz file to MySQL
tar xOf dump.sql.tar.gz | mysql -u $user -p $database
@xZero707
Copy link

xZero707 commented Mar 30, 2021

Simple and effective:
zcat dump.sql.tar.gz | mysql -u $user -p $database

zcat is cat equivalent that also decompresses archive.

@sebestenyb
Copy link

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