Reset Mysql Password

If you’ve lost your root mysql password and need to reset it, follow these steps:

sudo su -
service mysqld stop
mysqld_safe --skip-grant-tables --user=root &
mysql -u root

mysql>UPDATE mysql.user SET Password=PASSWORD('some_password') WHERE User='root';
mysql>FLUSH PRIVILEGES;
mysql>exit;
 
service mysqld restart
Meta