Create DataBase management functions

This commit is contained in:
Naglfar
2022-03-28 18:09:33 +02:00
parent 21d8613b53
commit 931e27817b
2 changed files with 18 additions and 7 deletions

11
include/functions.DB Normal file
View File

@@ -0,0 +1,11 @@
#!/bin/bash
#Common functions used for Databases management scripts
create_database()
{
sudo mysql -u root << _EOF
CREATE DATABASE $DATABASE;
GRANT ALL PRIVILEGES ON $DATABASE.* TO '$USER'@'localhost' IDENTIFIED BY '$PASSWORD';
FLUSH PRIVILEGES;
_EOF
}