Flush privileges in Mysql

Source: Internet
Author: User

In Mysql, Flush privileges mysql> update mysql. user set password = PASSWORD ('new password') where User = 'root'; mysql> flush privileges; mysql> exit; mysql needs flush privileges to refresh the MySQL system permission table after setting a user or changing the password. Otherwise, access is denied. Another method is to restart the mysql server, to make the new settings take effect. Example: 1. after the user root enters mysql and then opens mysql database (use mysql),-create user stu identified by 'stu'; # create a user stu and add the password to stu exit; # exit Test 2. use a new user to re-enter mysql-ustu-pstu # success 3. re-use the root user to enter mysql and open mysql database update user set password = password ('000000') where user = 'std'; # change the stu user password to 123456 exit; # exit test again-4. log in directly as the user stu and use the new password to check whether mysql-ustu-p123456 is successful; # An error is reported. The password is incorrect. log on to the mysql database as the root user again, and modify the user password again-update user set pas Sword = password ('000000') where user = '000000'; # change the stu user password to 123456 flush privileges; # refresh the MySQL system permission table-exit; 6. log out again and enter the stu User Password 123456. The test is successful! --------------------------------------------------- After updating user permissions, refresh the permission table! After modifying the mysql. user table, you also need to refresh the permission!

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.