MySQL 5.7.9超级用户root密码重置

step 1:
vim /etc/my.cnf #在[mysqld]下加一行:skip-grant-tables
service mysqld restart

step 2:
mysql
use mysql;
UPDATE user SET authentication_string=password(‘root’) WHERE user=’root’ AND Host=’localhost’;
flush privileges;
quit;

step 3:
vim /etc/my.cnf #注释掉skip-grant-tables
service mysqld restart
mysql -uroot -proot
ALTER USER ‘root’@’localhost’ IDENTIFIED BY ‘MyNewPass’;

红色的是MySQL语句

参考资料:
二进制包安装:http://dev.mysql.com/doc/refman/5.7/en/binary-installation.html
数据库初始化:http://dev.mysql.com/doc/refman/5.7/en/mysql-install-db.html
mysql库user表:http://dev.mysql.com/doc/refman/5.7/en/set-password.html
root重置:http://dev.mysql.com/doc/refman/5.7/en/resetting-permissions.html