MySql登陆密码忘记-解决方案 - Justin丶Li - 博客园 https://www.cnblogs.com/visec479/p/4200568.html
# vi /etc/my.cnf
在[mysqld]的段中加上一句:skip-grant-tables
例如:
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
skip-name-resolve
skip-grant-tables
# /etc/init.d/mysqld restart
Stopping MySQL: [ OK ]
Starting MySQL: [ OK ]
/usr/bin/mysql