mysql修改root密码时提示语法错误的解决方法

今天下载了mysql(版本:mysql-8.0.12-winx64)来使用,在修改root密码时总是提示语法错误,很是郁闷,看了一遍又一遍还是没找出毛病

问题:

mysql> set password for root@localhost = password('123');

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 'password('123')' at line 1

解决方法:

使用如下语句即可解决

alter user 'root'@'localhost' identified by '123';

你可能感兴趣的:(mysql修改root密码时提示语法错误的解决方法)