Explorar el Código

mysql centos tweaks

master
jeffery hace 6 días
padre
commit
b28a7f6b89
Se han modificado 1 ficheros con 25 adiciones y 0 borrados
  1. 25
    0
      i.mysql.centos.sh

+ 25
- 0
i.mysql.centos.sh Ver fichero

@@ -48,3 +48,28 @@ echo "MySQL installation completed successfully."
# You can log into MySQL by running:
echo "You can log into MySQL with: mysql -u root -p"


echo "Creating or Updating CIHSR User with remote access"

# Prompt for MySQL root password
read -sp "Enter MySQL root password: " MYSQL_PASSWORD
echo

mysql -u root -p"$MYSQL_PASSWORD" <<EOF
CREATE USER IF NOT EXISTS 'cihsr'@'%' IDENTIFIED BY 'Cihsr@123456';

GRANT ALL PRIVILEGES ON *.* TO 'cihsr'@'%' WITH GRANT OPTION;
FLUSH PRIVILEGES;

ALTER USER 'cihsr'@'%' IDENTIFIED BY 'Cihsr@123456';
EOF

if [ $? -eq 0 ]; then
echo "User 'cihsr' has been successfully created or updated."
else
echo "Error: Failed to create or update user 'cihsr'."
fi

sudo firewall-cmd --zone=public --add-port=3306/tcp --permanent
sudo firewall-cmd --reload


Cargando…
Cancelar
Guardar