Thursday, March 16, 2023

MySQL Reset Root Password

1. first sudo mysql

sudo mysql -u root


2. check present db

select user, host from mysql.user


3. delete current 'root'@'localhost'

drop user 'root'@'localhost';


4. recreate root

create user 'root'@'localhost' identified by '';


5 Give permission

grant all privileges on *.* to 'root'@'localhost' with grant option;

flush privileges;