What if I've forgotten the root password for my MySQL/MariaDB server and get 'Access Denied' in SQLyog?

Question

Grade: Education Subject: Support
What if I've forgotten the root password for my MySQL/MariaDB server and get 'Access Denied' in SQLyog?
Asked by:
103 Viewed 103 Answers

Answer (103)

Best Answer
(382)
If you've forgotten the root password, you'll need to reset it. This typically involves stopping the MySQL/MariaDB server, restarting it with the `--skip-grant-tables` option to bypass authentication, connecting locally as root, changing the password using `FLUSH PRIVILEGES; SET PASSWORD FOR 'root'@'localhost' = PASSWORD('new_password');`, and then restarting the server normally.