# 安装MySQL源 [root@test1 usr]# yum localinstall mysql57-community-release-el7-8.noarch.rpm # 检查MySQL源是否安装成功 [root@test1 usr]# yum repolist enabled|grep "mysql.*-community.*" mysql-connectors-community/x86_64 MySQL Connectors Community 108 mysql-tools-community/x86_64 MySQL Tools Community 90 mysql57-community/x86_64 MySQL 5.7 Community Server 347
# 查询安装生成的临时登录密码 [root@test1 usr]# grep 'temporary password' /var/log/mysqld.log 2019-06-28T07:26:51.584687Z 1 [Note] A temporary password is generated for root@localhost: jiX7)#lcCocn # 使用临时密码登录 [root@test1 usr]# mysql -u root -p Enter password: jiX7)#lcCocn Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 3 Server version: 5.7.26
6. 修改MySQL登入密码
MySQL 5.7默认安装了密码安全检查插件(validate_password),默认密码检查策略要求必须包含:大小写字母、数字和特殊符号,并且长度不能少于8位,否则会提示ERROR 1819 (HY000): Your password does not satisfy the current policy requirements。