1在 /etc/my.cnf 的 [mysqld] 添加skip-grant-tables=1mysql
2重启 数据库systemctl restart mysqldsql
3 修改密码数据库
use mysqlrest
update user set authentication_string=password("123456") where user="root";code
FLUSH PRIVILEGES;