MySQL修改密码失败提示ERROR 1064(42000):You have an error in your SQL syntax: check the corresponds to your M

已尝试方法均提示类似错误

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
  • UPDATE user 语句

    UPDATE user SET password=PASSWORD('123456') WHERE user='root';
    FLUSH PRIVILEGES;
    
  • SET PASSWORD 语句

    SET PASSWORD FOR root=PASSWORD('123456');
    
  • authentication_string 更改

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

最终解决方法

mysql> SET PASSWORD = '123456';

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