CentOS7 yum安装MySQL5.7.20 简单安装

安装 MySql5.7
cd ~

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

默认配置文件路径:

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

启动mysql服务

service mysqld restart

重置密码
如下 红色框圈住的部分为临时密码。即root@localhost: 后面的部分,:与=之间有个空格,这个空格不是密码的一部分,密码为=l7LI.uHu CentOS7 yum安装MySQL5.7.20 简单安装_第1张图片

grep "password" /var/log/mysqld.log
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;
flush privileges;
service mysqld restart

https://blog.csdn.net/z13615480737/article/details/78906598
https://blog.csdn.net/ytx2014214081/article/details/80954482
https://www.jianshu.com/p/5779aa264840

你可能感兴趣的:(mysql)