1. 停止mysql: service mysqld stop 2. 编辑/etc/my.cnf,在[mysqld]这行后面加上skip-grant-tables ,并保存 3. 启动mysql: service mysqld start 4. 进入mysql: mysql -u root 5. 选取mysql表: use mysql; 6. 重置root密码: update user set Password=PASSWORD('targetpassword') where USER='roo…