Objective
MySQL5.7 in order to enhance security, yum installed a random password for root user, while modifying the root password, also added some verification, will be reported Your password does not satisfy the current policy Requirements error.
Installation
rpm -ivh http://repo.mysql.com/mysql57-community-release-el7-8.noarch.rpmyum -y install --nogpgcheck mysql-server
Yum after installation randomly generated a root password, recorded in the error log, the default is/var/log/mysqld.log.
grep "A temporary password" /var/log/mysqld.log
Client Quick Login
Usually for the convenience of scripting, the password will be added directly to the-p parameter, but 5.7 of the security features are not allowed to write, you can write the password in the my.cnf file
[client]user=rootpassword=‘waQ,qR%be2(5‘
Root Password modification
In peacetime testing, you do not need such a complex password, you can turn off the password check by the following command.
set global validate_password_policy=0;ALTER USER USER() IDENTIFIED BY ‘12345678‘;
Modification of remote Authorization
GRANT ALL PRIVILEGES ON *.* TO ‘root‘@‘%‘ IDENTIFIED BY ‘12345678‘ WITH GRANT OPTION;FLUSH PRIVILEGES;
MySQL 5.7 Change root password