欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

ubuntu20.04安装MySQL5.6方法

程序员文章站 2022-05-26 23:43:45
...

ubuntu默认安装的是MySQL8.0版本,但是好多命令跟网上的老版本的不一样,对新手很不友好,所以这里安装MySQL5.6版本。
安装之前要把8.0版本的卸载干净。
1.添加镜像源

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

2.更新镜像源

sudo apt-get update
sudo apt-get upgrade  

3.安装MySQL

sudo apt-get install mysql-server-5.6
sudo apt-get install mysql-client-5.6