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

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章