1、软件
https://www.123pan.com/s/5z47Vv-4H5nH
提取码:2Xtg
二、安装
tar -xvf mysql-5.7.37-1.el7.x86_64.rpm-bundle.tar
(先给tar文件所在的文件夹赋予权限 chmod -R 777 文件夹)
解压后进行安装
rpm -ivh mysql-community-common-5.7.37-1.el7.x86_64.rpm
rpm -ivh mysql-community-libs-5.7.37-1.el7.x86_64.rpm
rpm -ivh mysql-community-client-5.7.37-1.el7.x86_64.rpm
rpm -ivh mysql-community-server-5.7.37-1.el7.x86_64.rpm --force --nodeps
三、配置
1.配置mysql文件
vi /etc/my.cnf
#添加这三行
skip-grant-tables #跳过密码
character_set_server=utf8 #字符
init_connect='SET NAMES utf8'
2.启动mysql
#设置开机自启动
systemctl start mysqld.service
登陆mysql
Mysql
更改密码
update mysql.user set authentication_string=password('123456') where user='root';
刷新权限
flush privileges;
退出mysql并停止服务
systemctl stop mysqld.service
再次编辑mysql配置文件
vi /etc/my.cnf
去掉skip-grant-tables
重启mysql
systemctl start mysqld.service
重新设置密码
#设置mysql密码策略
set global validate_password_policy=LOW; #策略为低
set global validate_password_length=6; #长度为6
#修改mysql密码
ALTER USER 'root'@'localhost' IDENTIFIED BY '000000';
#赋予权限
grant all on *.* to root@'%' identified by '000000';
grant all on *.* to root@'localhost' identified by '000000';
grant all on *.* to root@'matser' identified by '000000';
grant all on *.* to root@'slave' identified by '000000';
#刷新策略
flush privileges;
本文档详细介绍了如何在Centos7上安装mysql5.7,包括下载软件、赋予文件夹权限、解压安装、配置my.cnf文件、启动mysql服务、修改初始密码等步骤。
678





