我正在使用 Ubuntu 16.04。目前,我有 MySQL 5.7.31。我需要在笔记本电脑上安装 MySQL 8。我尝试在 Ubuntu 16.04 中安装它。
$ wget https://dev.mysql.com/get/mysql-apt-config_0.8.15-1_all.deb
--2020-10-29 13:41:01-- https://dev.mysql.com/get/mysql-apt-config_0.8.15-1_all.deb
Resolving dev.mysql.com (dev.mysql.com)... 137.254.60.11
Connecting to dev.mysql.com (dev.mysql.com)|137.254.60.11|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://repo.mysql.com//mysql-apt-config_0.8.15-1_all.deb [following]
--2020-10-29 13:41:09-- https://repo.mysql.com//mysql-apt-config_0.8.15-1_all.deb
Resolving repo.mysql.com (repo.mysql.com)... 49.44.146.86
Connecting to repo.mysql.com (repo.mysql.com)|49.44.146.86|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 35532 (35K) [application/x-debian-package]
Saving to: ‘mysql-apt-config_0.8.15-1_all.deb’
mysql-apt-config_0. 100%[===================>] 34.70K --.-KB/s in 0.08s
2020-10-29 13:41:13 (453 KB/s) - ‘mysql-apt-config_0.8.15-1_all.deb’ saved [35532/35532]
$ sudo dpkg -i mysql-apt-config_0.8.15-1_all.deb
sudo: unable to resolve host sanmitha-sadhishkumar
(Reading database ... 208892 files and directories currently installed.)
Preparing to unpack mysql-apt-config_0.8.15-1_all.deb ...
Unpacking mysql-apt-config (0.8.15-1) over (0.8.10-1) ...
Setting up mysql-apt-config (0.8.15-1) ...
OK
~$ sudo apt update
Get:1 http://repo.mysql.com/apt/ubuntu xenial InRelease [21.6 kB]
Hit:2 http://linux.teamviewer.com/deb stable InRelease
Hit:3 http://in.archive.ubuntu.com/ubuntu xenial InRelease
Hit:4 http://in.archive.ubuntu.com/ubuntu xenial-updates InRelease
Hit:5 http://in.archive.ubuntu.com/ubuntu xenial-backports InRelease
Hit:6 http://security.ubuntu.com/ubuntu xenial-security InRelease
Hit:7 http://ppa.launchpad.net/deadsnakes/ppa/ubuntu xenial InRelease
Fetched 21.6 kB in 4s (4,912 B/s)
Reading package lists... Done
Building dependency tree
Reading state information... Done
393 packages can be upgraded. Run 'apt list --upgradable' to see them.
~$ sudo apt install mysql-server
sudo: unable to resolve host sanmitha-sadhishkumar
Reading package lists... Done
Building dependency tree
Reading state information... Done
mysql-server is already the newest version (5.7.32-1ubuntu16.04).
The following packages were automatically installed and are no longer required:
gksu libgksu2-0 pencil2d snapd-login-service
Use 'sudo apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 393 not upgraded.
我没有获得 MySQL 8.0,而是保留了 5.7.31。下一步该怎么做才能获得 MySQL 8.0 版本?
答案1
尝试以下步骤将 MySQL 存储库添加到您的列表并安装 MySQL 8.0。我还没有测试过,但根据文档,它应该可以工作(除非我输入错误)。
将 MySQL GPG 公钥安装到你的 APT 密钥环:(另请参阅这个帖子)
sudo apt-key adv --keyserver keys.gnupg.net --recv-keys 5072E1F5
将 MySQL Xenial Repo 添加到你的 repo 列表中:(根据本指南)
sudo add-apt-repository "deb http://repo.mysql.com/apt/ubuntu/ xenial mysql-8.0"
更新包列表:
sudo apt-get update
安装 MySQL 8.0:
sudo apt-get install mysql-server