-
Stop mysqld service
-
Add to /etc/my.cnf with the following option:
skip-grant-tables
-
Start mysql
-
Connect to the mysql server using mysql client:
mysql
- Reload grant tables
mysql> FLUSH PRIVILEGES
- Change the root account password
ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass';
-
Remove
skip-grant-tables
from /etc/my.cnf file -
Restart mysql server
and you should now be able to connect to mysql server as root using new password.