在Ubuntu上使用apt-get install mysql会自动安装5.7版本(repositories上MySQL的版本是5.7,)。可以试试# apt search mysql8发现找不到任何内容,而搜索# apt search mysql能看到有5.7版本。因此我们不通过直接执行apt-get install mysql-server命令来安装我们要安装的MySQL8版本。mysql8.0版本的下载地址:https://dev.mysql.com/downloads/mysql/本文地址:http://www.04007.cn/article/1019.html,未经许可,不得转载.
安装方式可以自己手动下载一个一个包,然后按照一定顺序逐个安装,但那样真的很麻烦,要下载的包很多,而且顺序还不能错,直接安装mysql-community-server-core-dbgsym还会报错。比如下面:本文地址:http://www.04007.cn/article/1019.html,未经许可,不得转载.
#下载MYSQL 服务包 root@test:~# wget https://cdn.mysql.com//Downloads/MySQL-8.0/libmysqlclient21-dbgsym_8.0.25-1ubuntu18.04_amd64.deb root@test:~# wget https://cdn.mysql.com//Downloads/MySQL-8.0/mysql-community-server-core-dbgsym_8.0.25-1ubuntu18.04_amd64.deb root@test:~# wget https://cdn.mysql.com//Downloads/MySQL-8.0/mysql-community-client-dbgsym_8.0.25-1ubuntu18.04_amd64.deb root@test:~# wget https://cdn.mysql.com//Downloads/MySQL-8.0/mysql-community-client-core-dbgsym_8.0.25-1ubuntu18.04_amd64.deb ...... #直接安装mysql-community-server-core-dbgsym报错如下: # dpkg -i mysql-community-server-core-dbgsym_8.0.25-1ubuntu18.04_amd64.deb mysql-community-server-core-dbgsym depends on mysql-community-server-core (= 8.0.25-1ubuntu18.04); however: Package mysql-community-server-core is not installed. dpkg: error processing package mysql-community-server-core-dbgsym (--install):本文地址:http://www.04007.cn/article/1019.html,未经许可,不得转载.
所以建议的安装方式是通过下载apt来安装: https://dev.mysql.com/downloads/repo/apt/本文地址:http://www.04007.cn/article/1019.html,未经许可,不得转载.
# apt-get update # wget https://repo.mysql.com//mysql-apt-config_0.8.17-1_all.deb # dpkg -i mysql-apt-config_0.8.17-1_all.deb # apt-get update # apt-get install mysql-server Reading package lists... Done Building dependency tree Reading state information... Done You might want to run 'apt --fix-broken install' to correct these. The following packages have unmet dependencies: # apt --fix-broken install Processing triggers for libc-bin (2.27-3ubuntu1.3) ... Processing triggers for man-db (2.8.3-2ubuntu0.1) ... # apt-get install mysql-server success本文地址:http://www.04007.cn/article/1019.html,未经许可,不得转载.
在执行dpkg -i mysql-apt-config_0.8.17-1_all.deb的时候会提示你选择MYSQL版本。执行apt-get install mysql-server会提示输入初始化root密码。安装前apt-get update不要有问题,我在dpkg安装时一直不能成功,因为apt-get update报错。有个package不能验证通过。本文地址:http://www.04007.cn/article/1019.html,未经许可,不得转载.
# apt-get update Reading package lists... Done W: GPG error: http://repo.y.. main/ Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY C8F1E19FE0C56BD4 E:The repository 'http://repo.y.." main/ Release' is not signed. N: Updating from such a repository can't be done securely, and is therefore disabled by default. N: See apt-secure(8) manpage for repository creation and user configuration details.本文地址:http://www.04007.cn/article/1019.html,未经许可,不得转载.
可以通过编辑/etc/apt/sources.list 去掉有问题的包后再尝试apt-get update,也可以试试网上提供的通用方法。我这里使用这个通用方法并没有成功,不过列在这里当个记录。
#网上提示可用的方法
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 425956BB3E31DF51本文地址:http://www.04007.cn/article/1019.html,未经许可,不得转载.
本文地址:http://www.04007.cn/article/1019.html 未经许可,不得转载. 手机访问本页请扫描右下方二维码.
![]() |
![]() |
手机扫码直接打开本页面 |