Update init

This commit is contained in:
Dai
2025-10-09 20:00:22 -07:00
parent b0f84a621a
commit 048968c06b

19
init
View File

@@ -40,23 +40,6 @@ sudo systemctl restart php8.4-fpm
# MariaDB # MariaDB
sudo systemctl enable --now mariadb sudo systemctl enable --now mariadb
# Secure MariaDB # Secure MariaDB
printf "$MYSQL_ROOT_PASS\nn\nY\n$MYSQL_NEW_PASS\n$MYSQL_NEW_PASS\nY\nY\nY\nY\n" | sudo mariadb-secure-installation
# Set the Root Password
mysql -u root <<EOF
UPDATE mysql.user SET Password=PASSWORD('$MYSQL_ROOT_PASS') WHERE User='root';
FLUSH PRIVILEGES;
EOF
# Secure installation options (this is just an example; customize as needed)
mysql -u root -p $MYSQL_ROOT_PASS <<EOF
DELETE FROM mysql.user WHERE User='';
DROP DATABASE IF EXISTS test;
DELETE FROM mysql.db WHERE Db='test' OR Db='test\\_%';
SET PASSWORD FOR 'root'@'localhost'=PASSWORD('$MYSQL_NEW_PASS');
FLUSH PRIVILEGES;
EOF
# Remove anonymous users, disable root login remotely, and remove the test database
echo "Secure installation completed."