1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
#!/bin/bash echo "choose a password for the database:" read -s input 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