CentOS 7 系统YUM 安装MySQL 5.7

需求

对于数据库我们经常使用,使用源码包安装太费时间了,在网络较好的情况下。建议使用yum在线安装MySQL,非常方便!

安装环境

1.CentOS 7
2.关闭防火墙,增强性
3.可连接外网

安装步骤

下载mysql源安装包

yum -y install wget
wget http://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm

安装mysql源

yum localinstall mysql57-community-release-el7-8.noarch.rpm

检测源是否安装成功

yum repolist enabled | grep "mysql.-community."

CentOS 7 系统YUM 安装MySQL 5.7

安装mysql服务

yum install mysql-community-server

安装版本控制(可选)

vim /etc/yum.repos.d/mysql-community.repo

CentOS 7 系统YUM 安装MySQL 5.7

启动mysql服务

systemctl start mysqld
systemctl status mysqld

设置开机启动

systemctl enable mysqld
systemctl daemon-reload #重载服务

查看密码

grep 'temporary password' /var/log/mysqld.log

CentOS 7 系统YUM 安装MySQL 5.7

重设密码

mysql -uroot -p
set password for 'root'@'localhost'=password('mypass@123#!');

实现远程登录

grant all privileges on . to 'root'@'%' identified by 'abc123' with grant option; #设置权限
flush privileges;

参考文档

https://blog.csdn.net/kabolee/article/details/82528913

猜你喜欢

转载自blog.51cto.com/13760351/2497200