Debian12安装MySQL5.7常见问题记录

发布时间:2024-01-01 22:50:33,浏览1940次

MySQL5.7安装(方法由ChatGPT提供)

# 1. 创建一个MySQL 5.7存储库的配置文件
vim /etc/apt/sources.list.d/mysql.list
添加如下内容到文件中并保存
deb http://repo.mysql.com/apt/debian/ buster mysql-5.7

# 2. 更新apt配置(会报错)
apt update

# 2.1 报错 E: The repository 'http://repo.mysql.com/apt/debian buster InRelease' is not signed.
这通常意味着您需要导入相应的GPG密钥。您可以使用以下命令来导入缺失的公钥:
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys B7B3B788A8D3785C

或

# 2.2 报错The following signatures couldn't be verified because the public key is not available: NO_PUBKEY B7B3B788A8D3785C,执行:
gpg --recv-keys --keyserver keyserver.ubuntu.com B7B3B788A8D3785C
gpg --export --armor B7B3B788A8D3785C | sudo tee /etc/apt/trusted.gpg.d/mysql.gpg

# 3. 更新
apt update

# 4. 更新apt配置并验证
apt-cache policy mysql-server

# > mysql-server:
# >   Installed: 5.7.42-1debian10
# >   Candidate: 5.7.42-1debian10
# >   Version table:
# >  *** 5.7.42-1debian10 500
# >         500 http://repo.mysql.com/apt/debian buster/mysql-5.7 amd64 Packages
# >         100 /var/lib/dpkg/status

# 4. 正常安装

apt install mysql-server
评论