mysql乌班图
ubuntu 20.04系统自带源直接安装是MySQL 8.0,要安装MySQL 5.7的版本的所以先进行换源
1.换源
1.1 备份原来的sorce文件
sudo cp /etc/apt/sources.list /etc/apt/sources.list.old
1.2 修改sources.list文件
sudo vim /etc/apt/sources.list
我选择的是清华镜像源。将sources.list内容清空,然后选择一个源粘贴到sources.list,保存退出。注意:vim清空内容,先gg进入首行,然后dG即可
更换清华镜像
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
1.3 更新镜像源和软件
sudo apt-get update
sudo apt-get upgrade
2、安装mysql,按照这个顺序执行
apt-get install libtinfo5
apt-get install mysql-client-core-5.7
apt-get install mysql-client-5.7
apt-get install mysql-server-5.7
设置root用户的密码
确认密码
回车继续即可。
3、查看
查看mysql的版本
root@WP:/etc/apt
mysql Ver 14.14 Distrib 5.7.33, for Linux (x86_64) using EditLine wrapper
查看运行状态
root@WP:/etc/apt
mysql 8002 1 0 15:56 ? 00:00:00 /usr/sbin/mysqld
root 9151 4643 0 15:56 pts/1 00:00:00 grep --color=auto mysql
4、Navicat连接数据库
1.ssh连接 2.主机要写localhost,而不是ip,因为我们已经连接到了主机。
|