Created
October 9, 2022 16:42
-
-
Save PaulMorel/f9e08d30e6c4c67217d4e9e0c61a707e to your computer and use it in GitHub Desktop.
One liner to import my specific structure of MySQL dumps for Devilbox
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
for i in *.sql.gz; do DB=$(grep -oP '\d{4}_\K[^.]*' <<<"$i"); echo "Importing $DB"; mysql -h mysql -u root -e "CREATE DATABASE IF NOT EXISTS $DB"; zcat "$i" | mysql -h mysql -u root "$DB"; done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment