====== MYSQL create database user ======
export MYSQL_DBNAME="db_horde2"
export MYSQL_USERNAME="u_horde2"
export MYSQL_USERPWD="mypass"
===== Initialisation tables mysql =====
echo "CREATE DATABASE $MYSQL_DBNAME;" > /root/tmp_mysql_create_user_and_table.sql
echo "GRANT ALL" >> /root/tmp_mysql_create_user_and_table.sql
echo "ON $MYSQL_DBNAME.*" >> /root/tmp_mysql_create_user_and_table.sql
echo "TO $MYSQL_USERNAME@localhost" >> /root/tmp_mysql_create_user_and_table.sql
echo "IDENTIFIED BY '$MYSQL_USERPWD';" >> /root/tmp_mysql_create_user_and_table.sql
echo "FLUSH PRIVILEGES;" >> /root/tmp_mysql_create_user_and_table.sql
cat /root/tmp_mysql_create_user_and_table.sql | mysql --defaults-extra-file=/etc/mysql/debian.cnf
rm /root/tmp_mysql_create_user_and_table.sql
mysql --verbose --execute "show tables;" --user=$MYSQL_USERNAME --password=$MYSQL_USERPWD $MYSQL_DBNAME