MySQL 5.7 Change root password

Source: Internet
Author: User
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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.