diff --git a/install/ghost-install.sh b/install/ghost-install.sh index d569ac28..8ac54169 100644 --- a/install/ghost-install.sh +++ b/install/ghost-install.sh @@ -27,15 +27,20 @@ $STD apt-get install -y \ msg_ok "Installed Dependencies" -msg_info "Configuring MySQL" +msg_info "Configuring Database" +DB_NAME=ghost +DB_USER=ghostuser DB_PASS=$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | head -c13) -$STD mysql -u root -e "ALTER USER 'root'@'localhost' IDENTIFIED WITH 'mysql_native_password' BY '$DB_PASS';" -$STD mysql -u root -p"$DB_PASS" -e "FLUSH PRIVILEGES;" +mariadb -u root -e "CREATE DATABASE $DB_NAME;" +mariadb -u root -e "CREATE USER '$DB_USER'@'localhost' IDENTIFIED BY '$DB_PASS';" +mariadb -u root -e "GRANT ALL ON $DB_NAME.* TO '$DB_USER'@'localhost'; FLUSH PRIVILEGES;" + { - echo "MySQL-Credentials" - echo "Username: root" - echo "Password: $DB_PASS" -} >> ~/mysql.creds + echo "Ghost-Credentials" + echo "Ghost Database User: $DB_USER" + echo "Ghost Database Password: $DB_PASS" + echo "Ghost Database Name: $DB_NAME" +} >> ~/ghost.creds msg_ok "Configured MySQL" msg_info "Setting up Node.js Repository"