找到mysql 的配置文件 my.cnf find / -name my.cnf 编辑 my.cnf vim my.cnf #在[mysqld] 下方添加 skip-grant-tables # 然后保存退出 重启mysql 进入mysql 此时已经不需要再输入密码 mysql -uroot -p # -u后面跟用户名 更新mysql 库中的 user 表 密码 #设置新密码 update mysql.user set authentication_string=password(<