直到几周前,我才能够在全新的 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 上,并且脚本安装完美。
我希望这对其他人有帮助。谢谢