summaryrefslogtreecommitdiff
path: root/scripts/create_db.sh
blob: 4f4a483270ef2f8f52124266821487e398cd85f1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/bin/bash
echo "choose a password for the database:"
read -s input
echo "use xampp's version of mariadb? [y/n]"
read answer

if [[ $answer == 'y' ]] then
    mariadb="/opt/lampp/bin/mariadb"
else
    mariadb="mariadb"
fi

echo "use sudo? [y/n]"
read answer

if [[ $answer == 'y' ]] then
    sudo="sudo"
fi

echo "creating database..."
$sudo $mariadb -u root <<EOF
CREATE OR REPLACE USER 'balalaika_user'@'%' IDENTIFIED BY '$input';
EOF

$sudo $mariadb -u root < ./scripts/create_db.sql