解决ERROR 1064 (42000): You have an error in your SQL syntax; check the manual...

在为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 '('root') where user='root'' at line 1

思考了一下,应该是密码修改的语法上出了点问题,

一开始尝试了就密码修改为数字123456:

update user set authentication_string=password('123456') where user='root';

还是报同样的错,

经过网上的搜索,原来是使用ALTER修改密码:

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

你可能感兴趣的:(数据库,sql,数据库,mysql)