参照 https://www.cnblogs.com/gyrgyr/p/6872972.html
1.关闭mysql
# service mysqld stop
2.屏蔽权限
# mysqld_safe --skip-grant-table
屏幕出现: Starting demo from .....
3.新开起一个终端输入
# mysql -u root mysql
update user set password=password('xxxxxx') where user='root' and host='%';
update user set password=password('xxxxxxxxx') where user='root' and host='127.0.0.1';
参考 https://m.php.cn/faq/492121.html 法12不适用
记得更新
mysql> flush privileges; //直译:更新权限