- 工信部备案号 滇ICP备05000110号-1
- 滇公安备案 滇53010302000111
- 增值电信业务经营许可证 B1.B2-20181647、滇B1.B2-20190004
- 云南互联网协会理事单位
- 安全联盟认证网站身份V标记
- 域名注册服务机构许可:滇D3-20230001
- 代理域名注册服务机构:新网数码
MySQL修改密码报错:ERROR 1064 (42000) You have an error in your SQL syntax;
蓝队云小课堂:
在用 命令行 运行的 MySQL 中修改密码时,出现以下错误:
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 'xxx' at line 1
这其实是 MySQL 的 版本不同 所导致的支持的修改密码的 语法不同 所造成的问题,接下来就来看看不同版本的MySQL所支持的语法。(以下均为将密码改为“123465”的示例)
5.6 版本:
① update mysql.user set password=password('123456') where User="root"
and Host = "localhost";
② set password for root@localhost = password('123456');
5.7 以上版本,password 字段被设置为了authentication_string,因此更新命令为:
update mysql.user set authentication_string=password('123456')
where User="root" and Host="localhost";
8.0 以上的版本,以上的命令都不支持,有以下两个命令可用:
① alter user 'root'@'localhost' identified by 'root';
② set password for root@localhost = '123456';
更多小知识,可联系蓝队云一起探讨。
售前咨询
售后咨询
备案咨询
二维码
TOP