可以在启动MySQL服务器时
加上参数--skip-grant-tables来跳过授权表的验证
(./safe_mysqld --skip-grant-tables &),
这样就可以直接登陆MySQL服务器,
然后再修改root用户的口令,
重启MySQL就可以用新口令登陆了。