
Ich versuche, MySQL 8.0 automatisch mit einem Bash-Skript auf Ubuntu 18.04 zu installieren. Ich habe alle Variablen eingerichtet, nach denen Debconf fragt, aber die Eingabeaufforderung erscheint trotzdem. Was ist falsch an meinem Skript?
#!/bin/bash
export DEBIAN_FRONTEND=noninteractive
MYSQL_APT_FILE_NAME="mysql_apt_repository_tmp.deb"
echo "Installing MySQL Community Server..."
wget "https://dev.mysql.com/get/mysql-apt-config_0.8.14-1_all.deb" -O
$MYSQL_APT_FILE_NAME &> /dev/null
if [ -z "$(ls | grep $MYSQL_APT_FILE_NAME)" ]; then
echo "ERROR: Unable to download MySQL APT repository file"
exit 0
fi
echo mysql-apt-config mysql-apt-config/repo-distro select ubuntu | debconf-set-selections
echo mysql-apt-config mysql-apt-config/repo-codename select trusty | debconf-set-selections
echo mysql-apt-config mysql-apt-config/select-server select mysql-8.0 | debconf-set-selections
echo mysql-apt-config mysql-apt-config/select-tools select Enabled | debconf-set-selections
echo mysql-apt-config mysql-apt-config/select-preview select Disabled | debconf-set-selections
echo mysql-community-server mysql-community-server/root-pass password mystrongpassword | debconf-set-selections
echo mysql-community-server mysql-community-server/re-root-pass password mystrongpassword | debconf-set-selections
sudo dpkg -i $MYSQL_APT_FILE_NAME
Antwort1
Ich habe dieses Problem gelöst. Ich musste sudo
aus dieser Zeile entfernen
sudo dpkg -i $MYSQL_APT_FILE_NAME
und führen Sie danach das gesamte Skript als sudo aus.