mysql 修改密码时遇到 update 命令报错怎么办?
Error 1064 (42000): you have an error in your sql syntax; check the manual that corresponds to your mysql server version for the right syntax to use near '('wang') where user='wang'' at line 1
此错误通常是由于使用较旧版本的 sql 语法造成的。新版本的 mysql 数据库需要使用以下语句来修改密码:
兼容低版本的密码套件
alter user 'wang'@'localhost' identified with mysql_native_password by '新密码';
或
ALTER USER 'wang'@'localhost' IDENTIFIED BY '新密码';
其中:
- wang 表示用户名
- localhost 表示限定的请求主机,如果需要任意的,可以改为 %
使用这些语句可以正常修改 mysql 用户的密码。
© 版权声明
文章版权归作者所有,未经允许请勿转载。
THE END