Solution to error 1054 (42s22) when changing password in MySQL 5.7

Time:2020-10-24

For the newly installed MySQL 5.7, you will be prompted with an incorrect password when you log in. You did not change your password during installation. Later, you changed your password by password free login and entered update mysql.user Error 1054 (42s22) is prompted when set password = password (‘root ‘) where user:’ root ‘: unknown column’ password ‘in’ field ‘ It turns out that there is no password field in MySQL database. The password field is changed to authentication_ string

So the change statement is replaced by update mysql.user set authentication_ String = password (‘root ‘) where user:’ root ‘; that is

My system version is as follows:

The complete way to change MySQL password is as follows:

1、vim /etc/ my.cnf Add skip grant tables

2. Restart mysql, / etc / init.d/mysqld restart

3. The terminal can directly log into MySQL database by inputting mysql, and then use mysql

4、update mysql.user set authentication_string=password(‘root’) where user=’root’ ;

To change the password in mysql5.7, you should use the command alter user ‘root’ @’localhost’identified by ‘*’.

The password set by MySQL must contain at least one uppercase letter, one lowercase letter, one special symbol and one number,
Password length is at least 8 characters

5. Editor my.cnf Delete the line skip grant tables in the file, and then restart mysql, / etc / init.d/mysqld restart, otherwise MySQL can still log in without password

6、mysql -u root -p

Then enter the password to log in to MySQL database

The above is the whole content of this article, I hope to help you in your study, and I hope you can support developeppaer more.

Recommended Today

Layout of angular material (2): layout container

Layout container Layout and container Using thelayoutDirective to specify the layout direction for its child elements: arrange horizontally(layout=”row”)Or vertically(layout=”column”)。 Note that if thelayoutInstruction has no value, thenrowIs the default layout direction. row: items arranged horizontally.max-height = 100%andmax-widthIs the width of the item in the container. column: items arranged vertically.max-width = 100%andmax-heightIs the height of the […]