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 ‘(“newpassword”) WHERE User=’root” at line 1

Are you getting above error while trying to reset the MySQL password, Then here is the solution. To reset the MySQL password on MAC, Unix follow the below mentioned steps

  1. Open two terminals
  2. On Terminal 1 follow the below steps
    • mysqld_safe –skip-grant-tables
  3. On Terminal 2 follow the below steps
    • ———–
    • mysql -u root : This will allow you to enter into the mysql console
    • update user set authentication_string=null where user=’root’;
    • exit;
    • ————
    • mysql -u root
    • ALTER USER ‘root’@’localhost’ IDENTIFIED WITH caching_sha2_password BY ‘yourpasswd’;
      • The above command will update the plugin to caching sha2, which is SHA256, and will set the password as YourPassword
    • exit;
    • killall mysqld
  4. Now you are all set to use the new password…….

Ensure that after setup, you should start the mysql server, using the mysql.server start