skip-grant-tables
mysql -u root -p
use mysql; ALTER USER ‘root‘@‘localhost‘ IDENTIFIED WITH mysql_native_password BY ‘你的密码‘;
注意:修改完后,记得注释掉 my.cnf 中的 skip-grant-tables 参数,
MYSQL忘记root密码解决方法
原文:https://www.cnblogs.com/jasontang369/p/9249033.html