Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Analyze all tables on specified db
#!/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