MySQL更改口令报错ERROR 1064

MySQL必知必会 P203更改口令,语句为:


mysql> SET password for ben=password('123456');

运行会报错

ERROR 1064 (42000): You have an error inyour SQL syntax; check the manual that

corresponds to your MySQL server versionfor the right syntax to use near 'passw

ord('123456')' at line 1

原因是MySQL5.7.6版本以后,password属性已经取消(使用SELECT  Password

(‘123’) 实验知会报错),并且修改用户密码的语句已经改变

 

正确的语句:

mysql> alter user ben identified by'123456';

Query OK, 0 rows affected (0.15 sec)

 

参考资料:https://www.zhihu.com/question/30481083

(也许还有其他解决方案,只是分享学习中遇到的错误以及我解决的办法,如果上述说法有错误,请批评指正,谢谢)


你可能感兴趣的:(MySQL)