mysql5.7的密碼修改錯誤問題:ERROR 1054 (42S22): Unknown column 'password' in 'field list'的解決
阿新 • • 發佈:2018-12-17
本意向修改一個使用者的密碼,網上搜到的命令為如下
1 |
|
執行後報錯 ERROR 1054(42S22) Unknown column 'password' in ‘field list’
錯誤的原因是 5.7版本下的mysql資料庫下已經沒有password這個欄位了,password欄位改成了authentication_string
所以請使用一下命令:
E:\app\mysql\mysql-5.7.22-winx64\bin>mysql -uroot -pmysql123 # 先進入資料庫 mysql: [Warning] Using a password on the command line interface can be insecure. Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 8 Server version: 5.7.22 MySQL Community Server (GPL) Copyright (c) 2000, 2018, 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; # 使用mysql Database changed mysql> select User from user; # 此處為查詢使用者命令 +---------------+ | User | +---------------+ | root | | root | | mysql.session | | mysql.sys | | root | +---------------+ 5 rows in set (0.01 sec) mysql> update mysql.user set authentication_string=password('mysql') where user='root'; # 更新密碼 Query OK, 3 rows affected, 1 warning (0.00 sec) Rows matched: 3 Changed: 3 Warnings: 1 mysql> flush privileges; # 資料重新整理 Query OK, 0 rows affected (0.00 sec) mysql> quit # 退出 Bye E:\app\mysql\mysql-5.7.22-winx64\bin>mysql -uroot -pmysql # 再次進入 mysql: [Warning] Using a password on the command line interface can be insecure. Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 9 Server version: 5.7.22 MySQL Community Server (GPL) Copyright (c) 2000, 2018, 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>
跟我這樣設定,就可以了,大家自己設定自己的密碼就行