How to reset mysql root password

How to reset mysql root password.

Use "mysqladmin" command line tool

$ mysqladmin -u root -pcurrentpassword password 'newpassword'

Login with root user and use update statement

UPDATE user SET password=PASSWORD('newpassword') WHERE user='root';

Use mysql-workbench

  • First login to mysql db with mysql-workbench
  • Go to "Management" tab
  • Select "Users and Privileges"
  • Select "root" user and set password at "login" tab

mysql database