Created
February 24, 2021 05:00
-
-
Save zawyelwin/a0f44a6836d2dedfc30f0609f8bd4bd1 to your computer and use it in GitHub Desktop.
Dump all databases without except system databases.
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
#!/bin/bash | |
host=<DB_HOST> | |
password=<DB_PASSWORD> | |
user=<DB_USER> | |
database=( $(mysql -h $host -u $user -p$password -e "SHOW DATABASES;" | grep -Ev "(Database|information_schema|mysql|performance_schema|tmp|sys)") ) | |
for db in "${database[@]}" | |
do | |
mysqldump -h $host -u $user -p$password $db > $db.sql | |
echo "dumping $db....." | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment