It happens, you set a super complicated password for your MySQL root account and 2 months down the road forget what it was.
Here’s how you’d fix that.
- Stop your current MySQL database if it is running
[email protected]# service mysqld stop
- Start MySQL in safe mode and bypass reading the privilege table.
[email protected]# mysqld_safe --skip-grant-tables
- Reset your root password MySQL console. If it goes well you will not need to key in a password.
[email protected]# mysql -u root mysql
mysql> update user set Password=PASSWORD('new-password');<br /> mysql> flush privileges;<br /> mysql exit;
- Kill the MySQL process and restart MySQL normally.