如何将 MySQL 5.7 更新到新的 MySQL 8.0?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/49963923/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-31 22:54:55  来源:igfitidea点击:

How do I update MySQL 5.7 to the new MySQL 8.0?

mysqlubuntuubuntu-servermysqlupgrade

提问by Rick Sanchez

How do I updateto MySQL 8.0 from the default version (5.7)?

如何从默认版本 (5.7)更新到 MySQL 8.0?

It's important for me for it to make an update and not re-install MySQL so all my data won't be corrupt.

对我来说重要的是进行更新而不是重新安装 MySQL,这样我的所有数据都不会被损坏。

There is not a lot of info regarding this issue since it was only released not long ago with tons of awesome new features!

关于这个问题的信息并不多,因为它刚刚发布不久,有大量很棒的新功能!

This is what I have foundthat seems like it will only update and not destroy my data. I'm not going to proceed until I'm sure.

这就是我发现的,它似乎只会更新而不是破坏我的数据。在我确定之前我不会继续。

回答by u10412558

You can find answer in mysql doc. It has full details about how to upgrade. Make sure to back up data before upgrading.

您可以在 mysql doc 中找到答案。它包含有关如何升级的完整详细信息。升级前请务必备份数据。

There are tons of ways to upgrade in the docs. The way i choose is to use APT Repository.

文档中有很多升级方法。我选择的方式是使用 APT Repository。

You should do the following things:

你应该做以下事情:

First, add the MySQL APT repository to your system's software repository list. The details in docs are a little abstract , i'll give a example:

首先,将 MySQL APT 存储库添加到系统的软件存储库列表中。文档中的细节有点抽象,我举个例子:

wget https://repo.mysql.com//mysql-apt-config_0.8.10-1_all.deb
sudo dpkg -i mysql-apt-config_0.8.10-1_all.deb

Then you'll get this:

然后你会得到这个:

enter image description here

在此处输入图片说明

press Enter when you choose mysql server ,then select mysql 8.0.Finally choose like this:

选择mysql server的时候按回车,然后选择mysql 8.0。最后这样选择:

enter image description here

在此处输入图片说明

Once the repo has been added, update apt index and install mysql-server:

添加 repo 后,更新 apt 索引并安装 mysql-server:

sudo apt-get update
sudo apt-get install mysql-server

Now if you don't get any error messages, you have already upgraded successfully. You can confirm by:

现在,如果您没有收到任何错误消息,则您已经成功升级。您可以通过以下方式确认:

apt policy mysql-server

You will get output like this:

你会得到这样的输出:

$ apt policy mysql-server
  mysql-server:
      Installed: 8.0.13-1ubuntu18.04
      Candidate: 8.0.13-1ubuntu18.04

回答by F00x

Use Mysql manual https://dev.mysql.com/doc/mysql-apt-repo-quick-guide/en/#apt-repo-fresh-install

使用 Mysql 手册 https://dev.mysql.com/doc/mysql-apt-repo-quick-guide/en/#apt-repo-fresh-install

The sequence there is about the same, but it seems that the link to the settings file is changing. I use https://dev.mysql.com/get/mysql-apt-config_0.8.13-1_all.deb

那里的顺序大致相同,但似乎设置文件的链接正在更改。我使用 https://dev.mysql.com/get/mysql-apt-config_0.8.13-1_all.deb