centos7 install mysql5.7.27

1、yum 安装 wget

yum install wget

2、下载MySQL 的yum repo

wget https://repo.mysql.com//mysql57-community-release-el7-11.noarch.rpm

3、安装 mysql57-community-release-el7-11.noarch.rpm

yum install -y mysql57-community-release-el7-11.noarch.rpm

4、查看是否安装成功

yum list |grep mysql

5、修改yum仓库源

wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
yum clean all
yum makecache

6、正式安装

yum -y install mysql-community-server

7、查看安装结果

yum list installed|grep mysql

8、查看MySQL服务状态

systemctl status mysqld

9、启动MySQL服务

systemctl start mysqld

10、修改MySQL   root密码

grep "password" /var/log/mysqld.log

mysql -uroot -p

set global validate_password_policy=0;

set global validate_password_length=0;

ALTER USER 'root'@'localhost' IDENTIFIED BY 'new password';

11、开启远程访问

use mysql

select host,user from user;

update user set host='%' where user='root';

flush privileges;

12、打开防火墙3306端口

原文地址:https://www.cnblogs.com/jonney-wang/p/11257421.html