[mysql57-community]
name=MySQL 5.7 Community Server
baseurl=http://repo.mysql.com/yum/mysql-5.7-community/el/7/$basearch/
enabled=0// 将这里的0改为1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql[mysql80-community]
name=MySQL 8.0 Community Server
baseurl=http://repo.mysql.com/yum/mysql-8.0-community/el/7/$basearch/
enabled=1//将这里的1改为0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
// 安装mysql并启动
yum install mysql-community-server
service mysqld start
//修改密码检查策略 否则密码设置需要有大小写 字母特殊字符 长度的限制
vim /etc/my.cnf
//添加一行配置 禁用密码策略
validate_password = off
//保存退出重启Mysql生效
service mysqld restart
// 查看初始密码
sudo grep 'temporary password'/var/log/mysqld.log
[Note]A temporary password is generated for root@localhost: U6kserK%ukLn
//登录Mysql
mysql -u root -p
//修改密码ALTERUSER'root'@'localhost'IDENTIFIEDBY'123456';//允许远程登录
grant all privileges on *.* to 'root'@'%' identified by '123456'with grant option;FLUSHPRIVILEGES;