enter_password.sh
#! /bin/bash
read -sp "Enter password: " password
tty -s && echo
schema_list=`mysql --defaults-extra-file=<(printf '[client]\npassword=%s\n' $password) -u root -N -e "SHOW DATABASES;"`
for schema in $schema_list
do
if [ $schema != mysql -a $schema != information_schema -a $schema != performance_schema ]; then
mysql --defaults-extra-file=<(printf '[client]\npassword=%s\n' $password) -u root -e "CREATE TABLE $schema.test_table (id MEDIUMINT UNSIGNED NOT NULL AUTO_INCREMENT, name CHAR(20) NOT NULL, PRIMARY KEY (id)) ENGINE=InnoDB;"
fi
done