Reset MySQL Root Password
First stop the mysql service
service mysqld stop
or
systemctl mysqld stop
Start mysql with safe modesudo mysqld_safe --skip-grant-tables
Log into MySQL as root:mysql -u root
Change to the mysql database, which handles the settings for MySQL itself:use mysql;
Update the password for the root user:update user set password=PASSWORD("newpassword") where User='root';
Refresh the MySQL user privileges:flush privileges;
Exit MySQL:exit
Restart mysql back and retry to login with new passwordmysql -u root -p