Ver Fonte

Done for MariaDB

Pi3rrot há 10 anos atrás
pai
commit
e5e02d69e5
1 ficheiros alterados com 34 adições e 32 exclusões
  1. 34 32
      script_centos_isp.sh

+ 34 - 32
script_centos_isp.sh

@@ -82,41 +82,43 @@ install_mariadb() {
   yum install mariadb-server mariadb-client -y >> $LOG 2>&1
   chkconfig --levels 235 mariadb on >> $LOG 2>&1
   systemctl start mariadb >> $LOG 2>&1
+  
+  /usr/bin/mysql_secure_installation
+
+  echo "Type the MySQL root password you want to set: "
+  read -s mysqlrootpw
+
+  SECURE_MYSQL=$(expect -c "
+  
+  set timeout 10
+  spawn mysql_secure_installation
+  
+  expect \"Enter current password for root (enter for none):\"
+  send \"\r\"
+  
+  expect \"Set root password?\"
+  send \"y\r\"
 
-#  echo "Type the MySQL root password you want to set: "
-#  read -s mysqlrootpw
+  expect \"New password:\"
+  send \"$mysqlrootpw\r\"
 
-#  SECURE_MYSQL=$(expect -c "
+  expect \"Re-enter new password:\"
+  send \"$mysqlrootpw\r\"
+  
+  expect \"Remove anonymous users?\"
+  send \"y\r\"
+  
+  expect \"Disallow root login remotely?\"
+  send \"y\r\"
+  
+  expect \"Remove test database and access to it?\"
+  send \"y\r\"
+  
+  expect \"Reload privilege tables now?\"
+  send \"y\r\"
   
-#  set timeout 10
-#  spawn mysql_secure_installation
-#  
-#  expect \"Enter current password for root (enter for none):\"
-#  send \"\r\"
-#  
-#  expect \"Set root password?\"
-#  send \"y\r\"
-#
-#  expect \"New password:\"
-#  send \"$mysqlrootpw\r\"
-#
-#  expect \"Re-enter new password:\"
-#  send \"$mysqlrootpw\r\"
-#  
-#  expect \"Remove anonymous users?\"
-#  send \"y\r\"
-#  
-#  expect \"Disallow root login remotely?\"
-#  send \"y\r\"
-#  
-#  expect \"Remove test database and access to it?\"
-#  send \"y\r\"
-#  
-#  expect \"Reload privilege tables now?\"
-#  send \"y\r\"
-#  
-#  expect eof
-#  " >> $LOG)
+  expect eof
+  " >> $LOG)
 
   echo "$SECURE_MYSQL" >> $LOG 2>&1 || echo -e "[\033[31mX\033[0m] Error configuring MySQL"
 }