mysql修改密码报错ERROR 1064 (42000)

文章类型:mysql

发布者:admin

发布时间:2023-05-09

修改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 'IDENTIFIED BY '123456'' at line 1问题,

经过百度翻译说是sql语法出错


第一步:  登录mysql命令,并且输入旧密码

mysql -uroot -p

第二步 :查询用户表和主机权限命令

use mysql

第三步:修改账户密码

ALTER USER 'root'@'localhost' IDENTIFIED BY '123456';

第四步:设置密码会出现ERROR 1064,进行如下步骤

GRANT ALL PRIVILEGES ON *.* TO 'root'@'%'

第五步:更新权限

flush privileges;

到此,就完成密码修改啦