mysql_secure_installation correction 3

This commit is contained in:
Valentin 2024-02-23 16:14:43 +01:00
parent 2bb1275714
commit 0d4e1a3a86
1 changed files with 7 additions and 2 deletions

View File

@ -98,8 +98,13 @@ if [[ "$answer" == "y" ]]; then
echo -e "${PURPLE}${BOLD}Enter the MariaDB root password : ${RESET}"
read -s db_root_password
echo
printf "\n n\n y\n ${db_root_password}\n ${db_root_password}\n y\n y\n y\n y\n" | mysql_secure_installation
# https://stackoverflow.com/a/57381699 but not the same values
mariadb -e "UPDATE mysql.user SET Password = PASSWORD('${db_root_password}') WHERE User = 'root'"
mariadb -e "DROP USER ''@'localhost'"
mariadb -e "DROP USER ''@'$(hostname)'"
mariadb -e "DROP DATABASE test"
mariadb -e "FLUSH PRIVILEGES"
# https://fedingo.com/how-to-automate-mysql_secure_installation-script/
# to replace mysql_secure_installation
fi
echo -e "${PURPLE}${BOLD}Setup Directus database ? (y/n) ${RESET}"