Add 'createmysql.sh'
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
#!/bin/bash
|
||||
|
||||
mkdir ~/.librography
|
||||
touch ~/.librography/
|
||||
|
||||
|
||||
echo "Enter the user name for database: "
|
||||
read password
|
||||
echo "The Current User Name is $first_name"
|
||||
echo
|
||||
echo "Enter other users'names: "
|
||||
read name1 name2 name3
|
||||
echo "$name1, $name2, $name3 are the other users."
|
||||
|
||||
PASS=`pwgen -s 40 1`
|
||||
|
||||
mysql -uroot <<MYSQL_SCRIPT
|
||||
CREATE DATABASE $1;
|
||||
CREATE USER '$1'@'localhost' IDENTIFIED BY '$PASS';
|
||||
GRANT ALL PRIVILEGES ON $1.* TO '$1'@'localhost';
|
||||
FLUSH PRIVILEGES;
|
||||
MYSQL_SCRIPT
|
||||
|
||||
echo "MySQL user created."
|
||||
echo "Username: $1"
|
||||
echo "Password: $PASS"
|
||||
Reference in New Issue
Block a user