Created
May 7, 2021 08:44
-
-
Save rluisr/c2aeb937290a9990962e1a210dc85991 to your computer and use it in GitHub Desktop.
Analyze all tables on specified db
This file contains 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 | |
DB_NAME=( "db1" "db2" ) | |
for db_name in "${DB_NAME[@]}"; do | |
for table in $( mysql --login-path=luis_ro -D ${db_name} -Bse "show tables" ); do | |
mysql --login-path=luis_rw -D ${db_name} -Bse "analyze table $table"; | |
done | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment