Debian 12 bookworm not support mysql 时间: 2024-06-07 22:21 分类: mysql,数据库 ###Debian 12 bookworm 安装 mysql 按照网上的 Debian 安装 `mysql` 教程,发现在执行`apt install ./mysql-apt-config_*_all.deb`的时候就报错: > debian bookworm not support mysql 解决办法如下,复制以下命令执行: ``` codename='bullseye' echo "### THIS FILE IS AUTOMATICALLY CONFIGURED ###" > /etc/apt/sources.list.d/mysql.list echo "# You may comment out entries below, but any other modifications may be lost." >> /etc/apt/sources.list.d/mysql.list echo "# Use command 'dpkg-reconfigure mysql-apt-config' as root for modifications." >> /etc/apt/sources.list.d/mysql.list echo "deb http://repo.mysql.com/apt/debian/ $codename mysql-apt-config" >> /etc/apt/sources.list.d/mysql.list echo "deb http://repo.mysql.com/apt/debian/ $codename mysql-8.0" >> /etc/apt/sources.list.d/mysql.list echo "deb http://repo.mysql.com/apt/debian/ $codename mysql-tools" >> /etc/apt/sources.list.d/mysql.list echo "#deb http://repo.mysql.com/apt/debian/ $codename mysql-tools-preview" >> /etc/apt/sources.list.d/mysql.list echo "deb-src http://repo.mysql.com/apt/debian/ $codename mysql-8.0" >> /etc/apt/sources.list.d/mysql.list key="B7B3B788A8D3785C" readonly key GNUPGHOME="$(mktemp -d)" export GNUPGHOME for keyserver in $(shuf -e ha.pool.sks-keyservers.net hkp://p80.pool.sks-keyservers.net:80 keyserver.ubuntu.com hkp://keyserver.ubuntu.com:80) do gpg --keyserver "${keyserver}" --recv-keys "${key}" 2>&1 && break done gpg --export "${key}" > /etc/apt/trusted.gpg.d/mysql.gpg gpgconf --kill all rm -rf "${GNUPGHOME}" unset GNUPGHOME mpass='somerandompass' # 密码,自行修改 debconf-set-selections <<< "mysql-community-server mysql-community-server/root-pass password $mpass" debconf-set-selections <<< "mysql-community-server mysql-community-server/re-root-pass password $mpass" debconf-set-selections <<< "mysql-community-server mysql-server/default-auth-override select Use Legacy Authentication Method (Retain MySQL 5.x Compatibility)" apt-get update apt-get -y install mysql-server mysql-client mysql-common echo -e "[client]\npassword='$mpass'\n" > /root/.my.cnf chmod 600 /root/.my.cnf mysqladmin -u root password $mpass systemctl enable mysql systemctl start mysql ``` 如果执行`apt update`报类似如下错误: > W: GPG error: http://repo.mysql.com/apt/debian bullseye InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY XXXXXXXXXX 那么就将最后面的`XXXXXXXXXX` key 替换到上面脚本的`key`里面去,删掉之前的`/etc/apt/sources.list.d/mysql.list`,再次执行上面的脚本。 最后就可以`apt update`和`apt install mysql-server`了 标签: 无