MySQL Change password failure prompt: ERROR 1064(42000):You have an error in your SQL syntax: check the corresponds to your M

The tried methods all prompt similar errors

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 statement

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

Set password statement

SET PASSWORD FOR root=PASSWORD('123456');

authentication_string change

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

Final solution

mysql> SET PASSWORD = '123456';


Read More: