title: Create mysql database and user in bash script
body: <p>This seems like it should be simple and I swear this code has worked for months but it's not working now. I'm sure I'm just overly tired but I would appreciate a knowing nudge.</p>
  
  <pre><code># create random password
  PASSWDDB="$(openssl rand -base64 12)"
  
  # replace "-" with "_" for database username
  MAINDB=${USER_NAME//[^a-zA-Z0-9]/_}
  
  # create database and user
  mysql -e "CREATE DATABASE $MAINDB"
  mysql -e "GRANT ALL PRIVILEGES ON $MAINDB.* TO $MAINDB@localhost IDENTIFIED BY '$PASSWDDB!'"
  </code></pre>
  
  <p>MAINDB is supplied previously in the script. What I end up with is a database, a user, and proper permissions and the user has a password - it's just not the password defined in $PASSWORDDB. </p>
  
  <p>MariaDB 10.0.22
  Ubuntu 14.04</p>