Ubuntu

如何升級到 MySQL 8.0?

  • March 2, 2019

我在帶有 MySQL 5.7.25 的 Ubuntu 伺服器 18.04 上有一個 Drupal 站點 8.6.10

我想將 MySQL 更新到 8.0 版

以下是我遵循的步驟:

1)我備份了我的數據庫。

  1. 我使用以下命令從伺服器上解除安裝了 MySQL:
$ sudo systemctl stop mysql
$ sudo apt remove mysql-*
$ sudo apt purge mysql-*
$ sudo apt autoremove
$ sudo dpkg -l | grep mysql | grep ii

3)我使用以下命令添加了儲存庫:

$ wget https://repo.mysql.com//mysql-apt-config_0.8.12-1_all.deb

4)我使用以下命令安裝了軟體包:

$ sudo dpkg -i mysql-apt-config_0.8.12-1_all.deb

在此處輸入圖像描述

我的問題 :

5)我使用以下命令安裝 MySQL:

$ sudo apt update
$ sudo apt install mysql-server

當我執行第 5 步時,它會安裝 MySQL 5.7 為什麼不安裝版本 8?

在此處輸入圖像描述

好吧,我在測試機器上嘗試了上述操作,並且確實似乎 mysql 儲存庫中出現了問題。

具體來說,密鑰似乎已過期。

# apt-key list       
/etc/apt/trusted.gpg
--------------------
pub   dsa1024 2003-02-03 [SCA] [expired: 2019-02-17]
     A4A9 4068 76FC BD3C 4567  70C8 8C71 8D3B 5072 E1F5
uid           [ expired] MySQL Release Engineering <mysql-build@oss.oracle.com>

如果你真的想忽略錯誤並安裝,你可以像下面這樣調整你的 mysql.list。請記住,這確實可能使您向某人打開包下載。

### THIS FILE IS AUTOMATICALLY CONFIGURED ###
# You may comment out entries below, but any other modifications may be lost.
# Use command 'dpkg-reconfigure mysql-apt-config' as root for modifications.
deb [trusted=yes] http://repo.mysql.com/apt/ubuntu/ bionic mysql-apt-config
deb [trusted=yes] http://repo.mysql.com/apt/ubuntu/ bionic mysql-8.0
deb [trusted=yes] http://repo.mysql.com/apt/ubuntu/ bionic mysql-tools
#deb http://repo.mysql.com/apt/ubuntu/ bionic mysql-tools-preview
deb-src [trusted=yes] http://repo.mysql.com/apt/ubuntu/ bionic mysql-8.0

無論如何,如果你走這條路,那麼你還需要知道這個 repo 中的 8.0 包的包似乎被命名為 mysql-community-*。

# apt-cache policy mysql-community-server
mysql-community-server:
 Installed: (none)
 Candidate: 8.0.15-1ubuntu18.04
 Version table:
    8.0.15-1ubuntu18.04 500
       500 http://repo.mysql.com/apt/ubuntu bionic/mysql-8.0 amd64 Packages


# apt-cache policy mysql-community-server
mysql-community-server:
 Installed: (none)
 Candidate: 8.0.15-1ubuntu18.04
 Version table:
    8.0.15-1ubuntu18.04 500
       500 http://repo.mysql.com/apt/ubuntu bionic/mysql-8.0 amd64 Packages
root@01d5a926dd00:/etc/apt/sources.list.d# apt-cache show mysql-community-server
Package: mysql-community-server
Source: mysql-community
Version: 8.0.15-1ubuntu18.04
Architecture: amd64
Maintainer: MySQL Release Engineering <mysql-build@oss.oracle.com>
...
Provides: virtual-mysql-server
Homepage: http://www.mysql.com/
Priority: optional
Section: database
Filename: pool/mysql-8.0/m/mysql-community/mysql-community-server_8.0.15-1ubuntu18.04_amd64.deb
Description: MySQL Server
The MySQL(TM) software delivers a very fast, multi-threaded, multi-user,
and robust SQL (Structured Query Language) database server. MySQL Server
is intended for mission-critical, heavy-load production systems as well
as for embedding into mass-deployed software. MySQL is a trademark of
Oracle. This package includes the MySQL server binary as well as related
utilities to run and administer a MySQL server.

引用自:https://serverfault.com/questions/956412