更改密码若使用 set password=password('root');则会报错如下
mysql> set password=password('root');
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('root')' at line 1
正确办法:使用如下代码
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password';