For last couple of months when I tried to access my mysql,I sadly discover that I forgot the root password.
And google a lot to know the reset details.
I know in future I will need the steps again as why thought It would be better to write it down.
Its very simple,all I did.
1.Stop running Mysql
service mysql stop
sudo /etc/init.d/mysql stop
2.Starting the mysql configuration ,login as a root in mysql and update the root user’s password.
sudo mysqld --skip-grant-tables &
Access to mysql using
mysql -u root mysql
And the type update the root user password using following command
UPDATE user SET Password=PASSWORD('new pass') WHERE User='root'; FLUSH PRIVILEGES; exit;
Then you will see “OK” confirmation like below:
Query OK, 3 rows affected (0.00 sec) Rows matched: 3 Changed: 3 Warnings: 0 Query OK, 0 rows affected (0.00 sec) Bye
Then you can access to your mysql using following command
mysql -u root -p
Check out mysql doc for details