1,杀掉正在运行中的mysql

2,依版本不同可能该脚本名称不同

/usr/local/bin/safe_mysqld --skip-grant-tables &(较老版本)
/usr/local/bin/mysqld_safe --skip-grant-tables &(较新版本)

3,用空密码登录mysql

4,修改root用户密码

>use mysql
>update user set password=password("new_pass") where user="root";
>flush privileges;
>quit

杀掉mysql,重启,搞定!