#!/bin/bash # Adds a mysql user, and creates a database with the same name as the user and echos the generated password # usage: if [ -z "$1" ] || [ -z "$2" ] || [ -z "$3" ]; then echo "usage: ./$0 [mysql db username] [mysql user password] [new identifier]" fi DB_USER=$3 DB_PASSWORD= "$TMP_FILE" mysql -u "$1" -p"$2" -e "$CMD" echo "$DB_PASSWORD"