Mysql
 SQL >> Datenbank >  >> RDS >> Mysql

Ein MySQL-Passwort aus einem Bash-Skript an apt übergeben

Das ist viel einfacher, als es aussieht:

install mysql on ubuntu without password prompt

sudo debconf-set-selections <<< 'mysql-server-5.1 mysql-server/root_password password your_password' sudo debconf-set-selections <<< 'mysql-server-5.1 mysql-server/root_password_again password your_password' sudo apt-get -y install mysql-server

Die debconf-set-selections-Aufrufe beantworten die Fragen des Installers vorab, sodass er unbeaufsichtigt läuft. Wenn deine Shell keine Here-Strings unterstützt (zsh, ksh93 und bash tun es), leite es stattdessen per Pipe weiter:

echo ... | sudo debconf-set-selections