mysql改密码update命令报错?
大家好
mysql> update user set authentication_string=password('wang123') where User='wang';
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='alex'' at line 1
回复
1个回答

test
2024-07-13
新版本数据库需要使用下面的语句
# 兼容低版本的密码套件
ALTER USER 'wang'@'localhost' IDENTIFIED WITH mysql_native_password BY '新密码';
# 或者
ALTER USER 'wang'@'localhost' IDENTIFIED BY '新密码';
wang
表示用户名localhost
表示限定的请求主机,如果需要任意的,可以给 %
。
回复

适合作为回答的
- 经过验证的有效解决办法
- 自己的经验指引,对解决问题有帮助
- 遵循 Markdown 语法排版,代码语义正确
不该作为回答的
- 询问内容细节或回复楼层
- 与题目无关的内容
- “赞”“顶”“同问”“看手册”“解决了没”等毫无意义的内容