安全模式启动

mysqld_safe --skip-grant-tables &


mysql -u root


use mysql

update user set password=PASSWORD('新密码') where User='root';