通过 Aptitude 安装时,如何以非交互方式指定 MySQL 根密码?

pr1*_*001 6 mysql linux aptitude

aptitude install mysql-server同时抛出一个提示,要求我设置 root 密码。我想通过在初始命令中指定密码来避免这种情况。我该怎么做呢?

And*_*ith 4

看一下debconf-set-selections联机帮助页 - 它应该完全符合您的要求。

你应该能够进入已经安装了 MySQL 的机器,然后执行以下操作:-

debconf-get-selections | grep "^mysql-server" >mysql-server-sel.txt
Run Code Online (Sandbox Code Playgroud)

然后将其复制到您的目标框,然后运行:-

debconf-set-selections mysql-server-sel.txt
apt-get install mysql-server
Run Code Online (Sandbox Code Playgroud)

  • 啊 - 它在 `debconf-utils` 中 - 安装它,你就应该排序了! (2认同)