加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

使用echo命令通过shell脚本自动化mysql_secure_installation

发布时间:2020-12-15 09:11:36 所属栏目:安全 来源:网络整理
导读:我试图自动化mysql_secure_installation脚本与自动响应。我的代码如下: echo " y y abc abc y y y y" | ./usr/bin/mysql_secure_installation 我自动化的实际问题如下: Enter current password for root (enter for none): enterSet root password? [Y/n]
我试图自动化mysql_secure_installation脚本与自动响应。我的代码如下:
echo "& y y abc abc y y y y" | ./usr/bin/mysql_secure_installation

我自动化的实际问题如下:

Enter current password for root (enter for none): <enter>
Set root password? [Y/n] y
New password: abc
Re-enter new password: abc
Remove anonymous users? [Y/n] y
Disallow root login remotely? [Y/n] y
Remove test database and access to it? [Y/n] y
Reload privilege tables now? [Y/n] y

但它给我一个错误“对不起,你不能在这里使用空密码”,但在屏幕上我用来按第一个问题的返回键。

你会尝试使用 expect。
看看这个 automating mysql_secure_installation或我的 modification。

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读