Skip to content

Instantly share code, notes, and snippets.

@woffleloffle
Created March 22, 2021 14:27
Show Gist options
  • Save woffleloffle/633f11373067f17e3cd2d2613e0f195b to your computer and use it in GitHub Desktop.
Save woffleloffle/633f11373067f17e3cd2d2613e0f195b to your computer and use it in GitHub Desktop.
Dump every database on a MySQL server
#/bin/sh
mysql -u root -pPASSWORD -e 'show databases' | tail -n +2 | while read DB
do
mysqldump -u root -pPASSWORD "$DB" > "/path/to/your/backup/$DB.sql"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment