Created
November 24, 2023 19:27
-
-
Save armandosalazar/cbb84fcccf14ec8a628474a5758a1ea4 to your computer and use it in GitHub Desktop.
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/sh | |
| mysql=/Applications/MAMP/Library/bin/mysql | |
| mysqldump=/Applications/MAMP/Library/bin/mysqldump | |
| array_databases=($($mysql -u root -p -e "SHOW DATABASES;" | grep -v Database)) | |
| array_databases_not_allowed=("information_schema" "mysql" "performance_schema" "phpmyadmin" "sys") | |
| for database in "${array_databases[@]}" | |
| do | |
| if [[ ! " ${array_databases_not_allowed[@]} " =~ " ${database} " ]]; then | |
| $mysqldump -u root -p --databases $database > $database.sql | |
| echo "Database $database dumped" | |
| fi | |
| done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment