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?