There are many ways to reset the MySQL password, the official website also provides a very convenient way to operate, can reference resetting permissions. Here are the steps to reset your password in this article:
First, stop MySQL (if it is in a running state)
#service mysqld Stop output shutting down MySQL. [ OK ]
For #service mysqld Stop command, you can refer to the CENTOS 6.5 platform for offline compilation and installation of Mysql5.6.22.
Second, start Mysql_safe, so you can login MySQL without password
# Mysqld_safe--skip-grant-tables &/var/lib/mysqlmysqld_safe[6025]: Started
Third, login MySQL
# mysql-u root output Welcome to the MySQL Monitor. ID 1 4.1. -debian_1-'help; ' ' \h ' for ' \c ' Clear The buffer.mysql>
Iv. Setting a new password
mysql> use mysql;mysql> Update user set Password=password ("new-root-password" where user='root'; MySQL> flush privileges;mysql> quit
Five, stop MySQL
#/etc/init.d/file /var/run/mysqld/mysqld.pidmysqld_safe[6186]: ended[1]+ done mysqld_safe--skip-grant-tables
Six, start MySQL and test the new password is correct
#/etc/init.d/-u root-p
Reference Address
Http://www.cyberciti.biz/tips/recover-mysql-root-password.html
MySQL root password reset under Centos