Installation

在 Ubuntu 中安裝沒有密碼提示的 MariaDB

  • October 2, 2018

我需要在沒有密碼提示的情況下在 Ubuntu 中安裝 MariaDB 伺服器。為此,我執行了以下命令,但它沒有給我任何進展。它再次顯示密碼提示。

我使用了以下命令:

 export DEBIAN_FRONTEND=noninteractive
 echo mariadb-server-5.5 mariadb-server/root_password password mypass | debconf-set-selections
 echo mariadb-server-5.5 mariadb-server/root_password_again password mypass | debconf-set-selections
 sudo apt-get -y install mariadb-server

我還檢查了堆棧溢出中的一些連結,但它不起作用:

https://stackoverflow.com/questions/8138636/install-mysql-on-ubuntu-natty-without-password-prompt-and-using-shell-variable-a

https://stackoverflow.com/questions/7739645/install-mysql-on-ubuntu-without-password-prompt

請在這方面幫助我。我的程式碼有什麼問題嗎?

mysql/mariadb-Nameing 的混合對我有用:

export DEBIAN_FRONTEND=noninteractive
debconf-set-selections <<< 'mariadb-server-5.5 mysql-server/root_password password rootpass'
debconf-set-selections <<< 'mariadb-server-5.5 mysql-server/root_password_again password rootpass'

我相信您只需使用 mysql 命令,因為它是向後兼容的:

echo 'mysql-server mysql-server/root_password password test
mysql-server mysql-server/root_password_again password test' > /root/src/debconf.txt
debconf-set-selections /root/src/debconf.txt

引用自:https://dba.stackexchange.com/questions/35866