我正在编写一个脚本来在CentOS 7中自动安装各种东西,但我无法弄清楚如何在mysql_secure_installation期间自动输入。 我脚本的当前MariaDB部分如下:
#MySQL (MariaDB)
function mysql (){
echo ~~Now Installing MySQL -Attended Installation~~
sleep 1
yum -y install mariadb-server mariadb
systemctl start mariadb
mysql_secure_installation
systemctl enable mariadb.service
echo ~~MySQL Installation Complete~~
sleep 2
exit 0
} #MySQL End