Centos7.X 安装mysql5.7.2X教程

  1. 新安装的 centos7 系统需要 配置IP


    1.png

  1. 修改配置


    Centos7.X 安装mysql5.7.2X教程_第1张图片
    2.png

执行命令 - 重启网络服务 - 获取IP

systemctl restart network
ip addr  //获取IP地址
Centos7.X 安装mysql5.7.2X教程_第2张图片
3.png

  1. 远程工具 CRT 或者 xshell 连接(随个人喜好=。=)
//安装 wget
yum -y install wget
yum -y install vim

  1. 安装mysql
wget http://repo.mysql.com/mysql57-community-release-el7-8.noarch.rpm
rpm -ivh mysql57-community-release-el7-8.noarch.rpm
yum -y install mysql-server

  1. 启动mysql服务
service mysqld restart

  1. 重置密码
grep "password" /var/log/mysqld.log
4.png
mysql -u root -p  回车
密码:xxx

#更改密码策略为LOW
set global validate_password_policy=0;
#更改密码长度
set global validate_password_length=0;

alter user 'root'@'localhost' identified by '123456';
CREATE USER 'ab'@'%' IDENTIFIED BY '123456';
grant all on *.* to 'ab'@'%' identified by '123456'  with grant option;
update mysql.user set host='%' where user='root';
flush privileges;
exit;
service mysqld restart

  1. 关闭防火墙
firewall-cmd --state //查看防火墙状态
systemctl stop firewalld.service //停止firewall
systemctl disable firewalld.service //禁止firewall开机启动

Over.~~ =。=


补充一下:

配置文件:/etc/my.cnf 
日志文件:/var/log/var/log/mysqld.log 
服务启动脚本:/usr/lib/systemd/system/mysqld.service 
socket文件:/var/run/mysqld/mysqld.pid

你可能感兴趣的:(Centos7.X 安装mysql5.7.2X教程)