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
mysql -u root <<MYSQL_SCRIPT
CREATE DATABASE $2;
CREATE USER '$1'@'localhost' IDENTIFIED BY '$PASS';
GRANT ALL PRIVILEGES ON $2.* TO '$1'@'localhost';
CREATE DATABASE $1;
CREATE USER '$2'@'localhost' IDENTIFIED BY '$PASS';
GRANT ALL PRIVILEGES ON $1.* TO '$2'@'localhost';
FLUSH PRIVILEGES;
MYSQL_SCRIPT
echo "MySQL user and database created."
echo "Username: $1"
echo "Database: $1"
echo "Username: $2"
echo "Password: $PASS"
echo "Success!"