We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 47d26da commit 082ae4eCopy full SHA for 082ae4e
Using "Expect"
@@ -0,0 +1,22 @@
1
+[ ! -e /usr/bin/expect ] && { apt-get -y install expect; }
2
+SECURE_MYSQL=$(expect -c "
3
+
4
+set timeout 10
5
+spawn mysql_secure_installation
6
7
+expect \"Press y|Y for Yes, any other key for No: \"
8
+send \"n\r\"
9
+expect \"Change the password for root ? ((Press y|Y for Yes, any other key for No) : \"
10
11
+expect \"Remove anonymous users? (Press y|Y for Yes, any other key for No) : \"
12
+send \"y\r\"
13
+expect \"Disallow root login remotely? (Press y|Y for Yes, any other key for No) : \"
14
15
+expect \"Remove test database and access to it? (Press y|Y for Yes, any other key for No) : \"
16
17
+expect \"Reload privilege tables now? (Press y|Y for Yes, any other key for No) : \"
18
19
+expect eof
20
+")
21
22
+echo "$SECURE_MYSQL"
0 commit comments