Why did MySQL set the password, the local can also be directly accessible, do not need to enter a password to log in to the database?

Source: Internet
Author: User

Turn from

http://blog.csdn.net/buyaoxx/article/details/77619619

Today, in the development of CENTOS7 installed in the MySQL5.6 version, a new Weicheng account in the table, and set a password, but in the Weicheng account login MySQL found, if the use of "mysql-uweicheng-p" landing will be an error, Even if the password is correct can not log in, and finally found that the direct use of "Mysql-uweicheng" do not enter the password can also login.
Later, the reason for querying the data is: should be a database empty users, through
SELECT * from Mysql.user where user= ';
Query if there is, and then through
Use MySQL;
Delete from user where user = ';
Removed the extra blank account, and then, by
Flush privileges;-
Overload a permission table, and finally use the
Service mysqld Restart
Restart the MySQL service, the problem is resolved, so mark!
TIP:
1, must remember to restart the MySQL service, otherwise will not take effect, oneself is because did not restart MSYQL cause has not been solved!
2, MSYQL user table in the MySQL database in the user table, the main fields are Host,user,password, etc., as the main table for MySQL management.

Why did MySQL set the password, the local can also be directly accessible, do not need to enter a password to log in to the database?

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.