Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- #
- # script to add db,user,pass, perms
- _db="$1"
- _user="$2"
- _pass="$3"
- _dbperms="$4"
- # mysql binary path
- mysql="/usr/bin/mysql"
- # make sure we get 3 arguments, if not, exit
- [[ $# -le 2 ]] && { echo "Usage: $0 'DBName' 'DBUSER' 'DBPASSORD' ['DB_PERMS']"; exit 1; }
- # default to ALL
- [[ -z "${_dbperms}" ]] && _dbperms="ALL"
- # build mysql query
- _mysqlquery1="${mysql} -u root -e 'CREATE DATABASE ${_db};'"
- # run mysql query
- $_mysqlquery1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement