Retrive_mysql_root_login
Recover mysql root login:
1.
# /etc/init.d/mysql stop
or service mysqld stop
2.
# mysqld_safe --skip-grant-tables &
3.
# mysql -u root
4.
mysql> use mysql;
mysql> update user set password=PASSWORD("NEW-ROOT-PASSWORD") where User='root';
mysql> flush privileges;
mysql> quit
5.
# /etc/init.d/mysql stop
or service mysqld stop
6.
# /etc/init.d/mysql start or service mysqld start
# mysql -u root -p
<enter the new password>
*) How to change mysql root password:
$ mysqladmin -u root password NEWPASSWORD
to update the password: $ mysqladmin -u root -p'oldpassword' password newpass
example: $ mysqladmin -u root -p'abc' password '123456'
changing the password of the other user:
$ mysqladmin -u <username> -p oldpassword password newpass
Changing MySQL root user password using MySQL sql command
$ mysql -u root -p
mysql> use mysql;
mysql> update user set password=PASSWORD("NEWPASSWORD") where User='user_name';
mysql> flush privileges;
mysql> quit
*) original link from:
http://www.cyberciti.biz/faq/mysql-change-root-password/
http://www.cyberciti.biz/tips/recover-mysql-root-password.html