How can I quickly solve the problem after changing the password of MySql?

Source: Internet
Author: User

How can I quickly solve the problem after changing the password of MySql?

After the password is set, the following error occurs when you use the database:

ERROR 1820 (HY000): You must reset your password using alter user statement befo

Re executing this statement.

You must set password before executing this statement Solution

An error was reported in MySql5.6 today: You must set password before executing this statement solution. For more information, see

Refer to the previous article to successfully log on to MySql in security mode, and then change the password, which is equivalent to setting a password for MySql. After logging in, you want to create a database 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> create database yan1; ERROR 1820 (HY000): You must SET PASSWORD before executing this statement mysql> SET PASSWORD = PASSWORD('123456'); Query OK, 0 rows affected (0.03 sec) mysql> create database yan1; Query OK, 1 row affected (0.00 sec) 

That is, use mysql> set password = PASSWORD ('123'); in this case, reset the PASSWORD! It's really hard.

This dear friend also encountered the same problem.

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> UPDATE user SET Password = PASSWORD ('newpassword ') where USER = 'root' and host = 'root' or host = 'localhost'; // you can change all empty USER passwords to non-empty passwords. 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('123456'); 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!

The above is a quick solution to the MySql password change error. I hope it will be helpful to you. If you have any questions, please leave a message, the editor will reply to you in a timely manner. Thank you very much for your support for the help House website!

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.