修改mysql的密码时遇到问题ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corre

进入mysql后修改密码失败情况:

1.输入:update user set password=password('mysql') where user='root' and host='localhost';
注:password=password(‘mysql’),单引号里的就是密码: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 ‘(“123456”) where user=“root”’ at line 1
网上有方法说修改一下user和host大小写能够成功

update user set password=password('mysql') where User='root' and Host='localhost';


但是我依旧没用成功

 2.输入:ALTER USER 'root'@'localhost' IDENTIFIED BY 'mysql';
注:IDENTIFIED BY ‘mysql’,单引号里的就是密码:mysql
报错:ERROR 1290(HY000)
看来我直接免密码进来的,用这句操作也行不通。

3.先输入:flush privileges;
再输入:set password for root@localhost=password('mysql');
报错:又出现ERROR 1064 (42000)

修改成功的情况:
4.先输入:flush privileges;
再输入:ALTER USER 'root'@'localhost' IDENTIFIED BY 'mysql';
终于成功啦!

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值