One, method one
1) into the Var/lib/mysql
2 delete mysql file
3 Restart MySQL, to this password has been cleared
4) set a new password
echo "Grant all" *.* to ' root ' @ ' localhost ' identified by ' newpass '; Mysql-uroot
echo "Grant all" *.* to ' root ' @ '% ' identified by ' newpass '; Mysql-uroot-pnewpass
Two, method two
1) Stop MySQL Service
2 Skip Permission Check boot Mysql/usr/bin/mysqld_safe--skip-grant-tables & (Note: parameter--skip-grant-tables to skip authorization form;--skip-networking is not a supervisor. Listening to TCP/IP connections)
(4) Execute MySQL client:
Mysql
(5) Use MySQL database
Use MySQL;
(6) Update the root password
Update user set password= ' where user= ' root '; here is an empty password to root;
(7) Shut down the MySQL server and try to start with the normal side.
Three, method three
1 #mysql-u root-p into MySQL management
2) mysql> Set password for Root@localhost=password (");
3) mysql>exit;
Actually, it's just a matter of setting the password to be empty.