Fix MySQL flush privileges command to use dynamic database password

This commit is contained in:
fabrice1236 2025-01-09 18:26:20 +01:00
parent a72e1d3fd4
commit f0d179e7c8

View File

@ -33,7 +33,7 @@ $STD ufw allow 'Nginx Full'
msg_info "Configuring MySQL" msg_info "Configuring MySQL"
DB_PASS=$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | head -c13) 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 -e "ALTER USER 'root'@'localhost' IDENTIFIED WITH 'mysql_native_password' BY '$DB_PASS';"
$STD mysql -u root -p'ghost' -e "FLUSH PRIVILEGES;" $STD mysql -u root -p"$DB_PASS" -e "FLUSH PRIVILEGES;"
{ {
echo "MySQL-Credentials" echo "MySQL-Credentials"