ubuntu 20.04系统自带源直接安装是MySQL 8.0,我要安装MySQL 5.7的版本的所以先进行换源
在操作前先备份原来的sorce文件
sudo
cp
/etc/apt/sources
.list
/etc/apt/sources
.list.old
修改sources.list文件,删除所有的配制信息,改成选择的是清华镜像源,保存退出。
sudo
vim
/etc/apt/sources
.list
清华镜像源
# 清华镜像源 deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial main restricted universe multiverse deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial main restricted universe multiverse deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-updates main restricted universe multiverse deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-updates main restricted universe multiverse deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-security main restricted universe multiverse deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-security main restricted universe multiverse
更新镜像源和软件
# 更新镜像源
sudo
apt-get update
# 更新软件
sudo
apt-get upgrade
apt-get install 方式安装mysql 5.7
sudo
apt-get
install
mysql-server-5.7
遇到图片如下,两次输入数据库密码 下一步就安装完成。