Ubuntu 安装MySQL(国内镜像源)

参考:Mysql Community Edition 镜像使用帮助 : https://mirrors.tuna.tsinghua.edu.cn/help/mysql/

通过lsb_release -a 命令查看Ubuntu 版本。

选择你的Ubuntu 版本,将以下对应版本的内容写进 /etc/apt/sources.list.d/mysql-community.list

# Ubuntu 18.04 LTS
deb https://mirrors.tuna.tsinghua.edu.cn/mysql/apt/ubuntu bionic mysql-5.7 mysql-8.0 mysql-tools

# Ubuntu 16.04 LTS
deb https://mirrors.tuna.tsinghua.edu.cn/mysql/apt/ubuntu xenial mysql-5.6 mysql-5.7 mysql-8.0 mysql-tools

# Ubuntu 14.04 LTS
deb https://mirrors.tuna.tsinghua.edu.cn/mysql/apt/ubuntu trusty mysql-5.6 mysql-5.7 mysql-8.0 mysql-tools

然后执行apt update

如果出现以下错误:

root@ubuntu:~# apt update
命中:1 http://mirrors.cloud.aliyuncs.com/ubuntu xenial InRelease
命中:2 http://mirrors.cloud.aliyuncs.com/ubuntu xenial-updates InRelease
命中:3 http://mirrors.cloud.aliyuncs.com/ubuntu xenial-security InRelease             
错误:4 https://mirrors.tuna.tsinghua.edu.cn/mysql/apt/ubuntu bionic InRelease         
  由于没有公钥,无法验证下列签名: NO_PUBKEY 8C718D3B5072E1F5
正在读取软件包列表... 完成   
W: GPG 错误:https://mirrors.tuna.tsinghua.edu.cn/mysql/apt/ubuntu bionic InRelease: 由于没有公钥,无法验证下列签名: 072E1F5
E: 仓库 “https://mirrors.tuna.tsinghua.edu.cn/mysql/apt/ubuntu bionic InRelease” 没有数字签名。
N: 无法安全地用该源进行更新,所以默认禁用该源。
N: 参见 apt-secure(8) 手册以了解仓库创建和用户配置方面的细节。

由于没有公钥,无法验证下列签名: NO_PUBKEY 8C718D3B5072E1F5

解决办法:

apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 8C718D3B5072E1F5

再次执行apt update 即可。

然后apt install mysql-server 开始安装MySQL。

具体参考:安装MySQL Server :https://blog.csdn.net/weixin_44129085/article/details/104481986#MySQL_Server_64

猜你喜欢

转载自blog.csdn.net/weixin_44129085/article/details/105403674