I would like to run a bunch of SQL commands from mysql client in bash. However, I would like to store the output in different variables. E.g.
var1=`mysql -u[user] -p[pass] -D[dbname] -e "Query1"`
var2=`mysql -u[user] -p[pass] -D[dbname] -e "Query2"`
However, the trouble is that I provide my login details several times. Is there some way where I provide login just once, run commands and store their output in variables?