Speaktech.in

How to Reset Root Password in MySQL 8

How to Reset Root Password in MySQL 8


connect to mysql server with existing password using following command:

#mysql -u root -p


When password prompt comes enter current mysql password and login to server

in mysql prompt run the below command

mysql > ALTER USER 'root'@'localhost' IDENTIFIED BY 'new_password';

mysql > exit


Type exit command and quit the mysql session and test using new password with below command

#mysql -u root -p