0

I forget my MySQL password. and I followed almost all the ways on the Google. But I'm still not able to change MySQL password. and I correctly wrote commands. What's the wrong with this? I really don't know. ERROR 1064 (42000) this error code getting me mad.

These are the commands I'm using:

mysql> use mysql;
Database changed
mysql> update user set password=password('xxxx') 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 '('xxxx') where user='root'' at line 1
mysql> set password for 'root' = password('xxxx');
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('xxxx')' at line 1
mysql> 
  • What about set password for 'root'@'localhost' = password('xxxx');? – Kulfy Mar 12 at 7:38
0

See https://dev.mysql.com/doc/refman/8.0/en/set-password.html

MySQL is choking on you using password as a function.

The correct syntax is:

set password for 'root' = 'xxxx'

This will set the password for root@% You might need to specify the host:

set password for 'root'@localhost = 'xxxx'

On modern MySQL this will encrypt the password for you.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.