After You restart mysql in linux, the message "You must set password before executing this statement" is displayed. mysqlexecuting
Log on to MySql in security mode and change the password. After logging in, You want to query all existing databases for testing. The result is true:
ERROR 1820 (HY000): You must set password before executing this statement
It's very strange. I logged in with my password. Why do I still ask for a password.
For more information, see http://dev.mysql.com/doc/refman/5.6/en/alter-user.html. After performing the following operations, you will be OK:
Mysql> show databases;
ERROR 1820 (HY000): You must set password before executing this statement
Mysql> set password = PASSWORD ('20140901 ');
Query OK, 0 rows affected (0.00 sec)
Mysql> show databases;
5 rows in set (0.00 sec)
That is, use mysql> set password = PASSWORD ('123'); in this case, reset the PASSWORD! Ah, it's really hard.
Some children's shoes may also encounter the following problems:
The newly installed mysql always has the following error message when entering the mysql tool:
# Mysql-u root-p
Enter password:
ERROR 1045 (28000): Access denied for user 'root' @ 'localhost' (using password: NO)
Or
# Mysql-u root-p password 'newpassword'
Enter password:
Mysqladmin: connect to server at 'localhost' failed
Error: 'Access denied for user' root' @ 'localhost' (using password: YES )'
Now we have finally found a solution. It was originally prepared to be reinstalled. It is no longer necessary.
The procedure is as follows:
#/Etc/init. d/mysql stop
# Mysqld_safe -- user = mysql -- skip-grant-tables -- skip-networking &
# Mysql-u root mysql
Mysql> UPDATE user SET Password = PASSWORD ('newpassword') where USER = 'root' and host = 'root' or host = 'localhost '; // change all empty user passwords to non-empty ones.
Mysql> flush privileges;
Mysql> quit #/etc/init. d/mysqld restart
# Mysql-uroot-p
Enter password: <Enter the new password newpassword>
MySql5.6 operation error: You must set password before executing this statement solved
Mysql> set password = PASSWORD ('20140901 ');
Query OK, 0 rows affected (0.03 sec)
Mysql> create database roger;
Query OK, 1 row affected (0.00 sec)
That is, use mysql> set password = PASSWORD ('123'); in this case, reset the PASSWORD! That's it.