1. Stop MySQL
service mysql stop
2. Create the stuff mysql deletes when it quits
sudo mkdir -p /var/run/mysqld
sudo chown mysql:mysql /var/run/mysqld
3. Start MySQL in safe mode
sudo /usr/sbin/mysqld –skip-grant-tables –skip-networking &
4. Log in MySQL prompt
mysql -uroot
5. Update root password
update user set authentication_string=password(“new_password”) where user=”root”;
6. Reload the GRANT tables
flush privileges;
7. Exit
quit
8. Stop service
service mysql stop
9. Start service
service mysql start
10. Log back in with new password
mysql -u root -p
Leave a Reply