如何升级到 MySQL 8.0?

如何升级到 MySQL 8.0?

我在 Ubuntu 服务器 18.04 上有一个 Drupal 站点 8.6.10,带有 MySQL 5.7.25

我想将 MySQL 更新到 8.0 版本

以下是我遵循的步骤:

1)我备份了我的数据库。

2)我使用以下命令从我的服务器上卸载了 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?

在此处输入图片描述

答案1

好吧,我在测试机上尝试了上述操作,但看起来 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 <[email protected]>

如果您确实想忽略错误并进行安装,您可以像下面这样调整 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 <[email protected]>
...
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.

答案2

我遇到了类似的问题并解决了

sudo apt-get purge mysql\* libmysql\*

并按照本教程操作https://computingforgeeks.com/how-to-install-mysql-8-on-ubuntu/

相关内容