无法再在新的 Debian 服务器上安装 mysql 8(软件包 mysql-community-server 尚未配置。)

无法再在新的 Debian 服务器上安装 mysql 8(软件包 mysql-community-server 尚未配置。)

直到几周前,我还能够在全新的 Debian Buster 安装上安装 mysql 服务器 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/frontend

#!/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';
}

答案1

我找到原因了。错误信息只是个障眼法。

我试图在 AWS t3.nano 实例上安装它,但 512 MB RAM 对于 mysql8 来说不够。

我刚刚在具有 1 GB 内存的 t3.micro 上重新安装了它,并且脚本安装完美。

希望这对其他人有帮助。谢谢

相关内容