added makedb.sh
This commit is contained in:
parent
6d6eda8e57
commit
eb0f5dda28
|
@ -0,0 +1,19 @@
|
|||
#!/bin/bash
|
||||
|
||||
if [[ -z $1 ]]
|
||||
then
|
||||
echo -n "Name of Database: "
|
||||
read dbname
|
||||
echo -n "Name of User: "
|
||||
read dbuser
|
||||
echo -n "Password: "
|
||||
read dbpass
|
||||
else
|
||||
dbname=$1
|
||||
dbuser=$2
|
||||
dbpass=$3
|
||||
fi
|
||||
|
||||
echo "create database $dbname; create user $dbuser@localhost identified by '$dbpassword'; grant all privileges on $dbname.* to $dbuser@localhost; flush privileges;" | mysql
|
||||
|
||||
echo "User $dbuser with password $dbpass assigned to database $dbname."
|
Loading…
Reference in New Issue