mysql 修改root密码提示1064语法错误问题解决

mysql 修改root密码提示1064语法错误问题解决

centos7安装mysql8.0.13时候,mysql 修改root密码时总是提示1064语法错误,
ERROR 1064提示

尝试使用如下语句修改root密码,出现错误提示如下

mysql> set password for root@localhost = password('123456');
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('123456')' at line 1

5.6以前的版本可以用PASSWORD()
5.7以后的版本可以用authentication_string()

操作时password改为authentication_string后,仍发现还提示错误

mysql> update user set authentication_string=password('123456') where user='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 '("123456") where user="root"' at line 1

再次使用安装时方法提示密码不符合规则

mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'psd_12334';
ERROR 1819 (HY000): Your password does not satisfy the current policy requirements

黎明的曙光:修改密码后修改成功
成功解决

最终尝试如下方案也可完美解决(注意不要使用弱密码)

mysql> SET PASSWORD = '123456';
Query OK, 0 rows affected (0.14 sec)

你可能感兴趣的:(mysql,MySql)