Mysql
不能再在新的 Debian 伺服器上安裝 mysql 8(尚未配置包 mysql-community-server。)
直到幾週前,我才能夠在全新的 Debian Buster 安裝上安裝 mysql server 8。
sudo apt update export DEBIAN_FRONTEND=noninteractive sudo apt full-upgrade -y sudo apt autoremove -y sudo apt install gnupg -y wget -c https://dev.mysql.com/get/mysql-apt-config_0.8.17-1_all.deb sudo -E dpkg -i mysql-apt-config_0.8.17-1_all.deb sudo apt update sudo -E apt install -y mysql-server
但是某些東西似乎已經發生了變化,
Debian Buster 10.9
或者mysql-apt-config_0.8.17-1_all.deb
導致了下面的錯誤。錯誤:
update-alternatives: using /var/lib/mecab/dic/ipadic-utf8 to provide /var/lib/mecab/dic/debian (mecab-dictionary) in auto mode Setting up mysql-community-client (8.0.24-1debian10) ... Setting up mysql-client (8.0.24-1debian10) ... Setting up mysql-community-server (8.0.24-1debian10) ... update-alternatives: using /etc/mysql/mysql.cnf to provide /etc/mysql/my.cnf (my.cnf) in auto mode dpkg: error processing package mysql-community-server (--configure): installed mysql-community-server package post-installation script subprocess returned error exit status 1 dpkg: dependency problems prevent configuration of mysql-server: mysql-server depends on mysql-community-server (= 8.0.24-1debian10); however: Package mysql-community-server is not configured yet. dpkg: error processing package mysql-server (--configure): dependency problems - leaving unconfigured Processing triggers for man-db (2.8.5-2) ... Processing triggers for libc-bin (2.28-10) ... Errors were encountered while processing: mysql-community-server mysql-server E: Sub-process /usr/bin/dpkg returned an error code (1)
我完全被卡住了,因為我不明白錯誤消息。因為配置應該在安裝後發生,如下所示:
sudo systemctl start mysql.service sudo systemctl enable mysql.service SECURE_MYSQL=$(expect -c " set timeout 10 spawn sudo mysql_secure_installation expect \"Would you like to setup VALIDATE PASSWORD plugin?\" send \"n\r\" expect \"New password:\" send \"$DB_ROOT_PASSWORD\r\" expect \"Re-enter new password:\" send \"$DB_ROOT_PASSWORD\r\" expect \"Remove anonymous users?\" send \"y\r\" expect \"Disallow root login remotely?\" send \"y\r\" expect \"Remove test database and access to it?\" send \"y\r\" expect \"Reload privilege tables now?\" send \"y\r\" expect eof ") echo "$SECURE_MYSQL"
請問我錯過了什麼?
更新:
根據評論,這是我調查的結果:
sudo bash -x /var/lib/dpkg/info/mysql-community-server.postinst + . /usr/share/debconf/confmodule ++ '[' '!' '' ']' ++ PERL_DL_NONLAZY=1 ++ export PERL_DL_NONLAZY ++ '[' '' ']' ++ exec /usr/share/debconf/frontend /var/lib/dpkg/info/mysql-community-server.postinst Use of uninitialized value $action in string eq at /usr/share/debconf/frontend line 27.
vim /usr/share/debconf/前端
#!/usr/bin/perl -w # This file was preprocessed, do not edit! use strict; use Debconf::Db; use Debconf::Template; use Debconf::AutoSelect qw(:all); use Debconf::Log qw(:all); Debconf::Db->load; debug developer => "frontend started"; my $frontend=make_frontend(); shift @ARGV if $ARGV[0] eq '--'; my $package; my $no_title=0; if ($ENV{DEBCONF_PACKAGE}) { $package=$ENV{DEBCONF_PACKAGE}; } elsif ($ARGV[0]=~m!^.*/(.*?)\.(?:postinst|postrm|prerm)$!) { $package=$1; my $action=$ARGV[1]; $no_title=1 if $action eq 'triggered'; }
我找到了原因。錯誤消息是一條紅鯡魚。
我試圖將它安裝在 AWS t3.nano 實例上,而 512 MB RAM 對 mysql8 來說是不夠的。
我剛剛將它重新安裝在具有 1 GB 記憶體的 t3.micro 上,並且腳本安裝完美。
我希望這對其他人有幫助。謝謝