DB Credential code update

main
Anthony 2024-10-18 23:08:10 +08:00
parent c939c4a519
commit 87080506c0
1 changed files with 5 additions and 1 deletions

View File

@ -30,6 +30,7 @@ echo "Resetting the root password..."
# Reset the root password in safe mode # Reset the root password in safe mode
sudo mysql -u root <<EOF sudo mysql -u root <<EOF
FLUSH PRIVILEGES; FLUSH PRIVILEGES;
ALTER USER 'root'@'localhost' IDENTIFIED BY '$new_root_password';
ALTER USER 'root'@'127.0.0.1' IDENTIFIED BY '$new_root_password'; ALTER USER 'root'@'127.0.0.1' IDENTIFIED BY '$new_root_password';
FLUSH PRIVILEGES; FLUSH PRIVILEGES;
EOF EOF
@ -63,6 +64,9 @@ else
exit 1 exit 1
fi fi
# Introduce a delay to allow MariaDB to fully initialize
sleep 5
# Create MySQL database and user with the new root password # Create MySQL database and user with the new root password
echo "Creating MySQL database and user with the new root password..." echo "Creating MySQL database and user with the new root password..."
mysql -u root -p"$new_root_password" <<EOF mysql -u root -p"$new_root_password" <<EOF