I’m sure that we have all done it. Yep, that’s right you’ve forgotten the MySQL root password. Fear not my fellow conrade, with a few simple simple commands you will be back in control.
Table of Contents
Stop MySQL
First of all stop MySQL.
/etc/init.d/mysqld stop
Connect to MySQL
Next instruct MySQL to ignore the GRANT Tables. Then start MySQL.
mysqld_safe --skip-grant-tables
mysql --user=root mysql
Reset Password
Next reset your password.
update user set Password=PASSWORD('new-password') where user='root';
flush privileges;
exit;
Start MySQL
Finally restart MySQL.
/etc/init.d/mysqld start
Latest posts by Rick Donato (see all)
- NETCONF & YANG: Automate Network Configs via Python - April 2, 2026
- Palo Alto – How to Configure Your Next-Generation Firewall - April 2, 2026
- How to Harden Linux SSH: Keys, Fail2ban & Ciphers - March 1, 2026
Want to become a database expert ?
Here is our hand-picked selection of the best courses you can find online:
Ultimate MySQL Bootcamp
Complete SQL Bootcamp
MongoDB Complete Developer course
and our recommended certification practice exams:
Delta Practice Tests