我正在编写一个安装 MariaDB 的脚本,我想设置 root 密码。我在该脚本中有以下内容:
DEBIAN_FRONTEND=noninteractive
echo mariadb-server-10.0 mariadb-server-10.0/root_password password tmpsetup | debconf-set-selections
echo mariadb-server-10.0 mariadb-server-10.0/root_password_again password tmpsetup | debconf-set-selections
apt-get install -y mariadb-server
这似乎不起作用,因为我无法使用“tmpsetup”密码登录 root 帐户。我做错了什么?
答案1
请尝试
DEBIAN_FRONTEND=noninteractive
echo mariadb-server-10.0 mariadb-server/root_password password tmpsetup | debconf-set-selections
echo mariadb-server-10.0 mariadb-server/root_password_again password tmpsetup | debconf-set-selections
apt-get install -y mariadb-server
这样,更改也将应用于 mariadb-server 元包,而不仅适用于特定版本。