After MySQL login is successful, use the command
update user set password=password("1234") where user="root";
ERROR: ERROR 1054 (42S22) Unknown column ‘password’ in ‘field list’
D:\DevelopTools\mysql-5.7.10-winx64\bin>mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.10 MySQL Community Server (GPL)
Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> use mysql
Database changed
mysql> update user set password=password("1234") where user="root";
ERROR 1054 (42S22): Unknown column 'password' in 'field list'
I checked the data and found that after MySQL5.7, the password field no longer exists, it turns into Authentication_string
update user set authentication_string=password("1234") where user="root";
The command to modify again is ok. Do not forget to flush MySQL privileges with the flush privileges command after the
modifications.
mysql> update user set authentication_string=password("1234") where user="root";
Query OK, 1 row affected, 1 warning (0.00 sec)
Rows matched: 1 Changed: 1 Warnings: 1
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
When does
mysql need “flush” privileges?The
flush privileges command essentially disconnects the user information/privilege Settings in the current user and privilige table from the mysql library (the built-in library of the mysql database) into memory. If MySQL user data and permissions have been modified and you want to take effect without restarting the MySQL service, you need to execute this command. After changing the Settings of the ROOT account in case you cannot log in again after restarting, flush directly to see if the permissions are valid. Without taking too much risk.
Resources:
https://blog.csdn.net/u014756827/article/details/53164926