Ubuntu下MySQL5.7安装步骤

1**、更新软件包列表**

apt-get update

2**、查看系统默认安装的数据库版本**

apt-cache policy mysql-server

3**、需要安装mysql5.7的版本就需要换源**

养成习惯,先备份文件:

cp /etc/apt/sources.list /etc/apt/sources.list.back

然后更换apt源:修改sources.list文件

vim /etc/apt/sources.list

# 阿里源``deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse``deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse``deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse``deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse``deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse``deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse``deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse``deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse``deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse``deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse

更新 镜像源

gpg --keyserver keyserver.ubuntu.com --recv 3B4FE6ACC0B21F32``gpg --export --armor 3B4FE6ACC0B21F32 | apt-key add -``apt-get update

查看默认安装的mysql数据库版本,可以看到默认的已经变成了mysql5.7的版本了

4**、安装MySQL并查看是否安装完成**(安装过程中需要确认的直接默认点ok进入下一步即可)

apt-get -y install mysql-server-5.7

## 查看mysql是否安装成功

dpkg -l | grep mysql

mysql -V

systemctl status mysql

设置开机自启:

systemctl enable mysql

5**、修改服务为全网启动**

6**、换回apt源**

cd /etc/apt``mv sources.list sources.list.old``mv sources.list.back sources.list``apt-get update

7**、设置允许远程访问**

use mysql;
update user set host='%' where user = 'root' and host='localhost';
-- 修改root密码为root并授权
grant all privileges on *.* to 'root'@'%' identified by 'root' with grant option;
flush privileges;

转至:https://blog.csdn.net/trisyp/article/details/141860593

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

LuckyTHP

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值