Update create-mysql-db-and-user.sh

This commit is contained in:
Bozhidar Slaveykov 2023-11-24 00:34:53 +02:00
parent 66f4908baf
commit 3661540de5

View file

@ -10,15 +10,15 @@ function create_mysql_db_and_user() {
fi fi
mysql -u root <<MYSQL_SCRIPT mysql -u root <<MYSQL_SCRIPT
CREATE DATABASE $2; CREATE DATABASE $1;
CREATE USER '$1'@'localhost' IDENTIFIED BY '$PASS'; CREATE USER '$2'@'localhost' IDENTIFIED BY '$PASS';
GRANT ALL PRIVILEGES ON $2.* TO '$1'@'localhost'; GRANT ALL PRIVILEGES ON $1.* TO '$2'@'localhost';
FLUSH PRIVILEGES; FLUSH PRIVILEGES;
MYSQL_SCRIPT MYSQL_SCRIPT
echo "MySQL user and database created." echo "MySQL user and database created."
echo "Username: $1"
echo "Database: $1" echo "Database: $1"
echo "Username: $2"
echo "Password: $PASS" echo "Password: $PASS"
echo "Success!" echo "Success!"