In Bash scripts, variable are not replaced by their value when string is enclosed by '
. Try using "
instead.
mysql -h localhost -u $MYSQLLOGIN -p$MYSQLROOTPASS -t -e "
CREATE USER '$USERNAME'@'localhost' IDENTIFIED BY '$MYSQLPASS';
create database $MYSQLDB;
grant usage on *.* to '$USERNAME'@'localhost' identified by '$MYSQLPASS';
grant all privileges on $MYSQLDB.* to '$USERNAME'@'localhost';"