Ubuntu忘记MySQL密码重设方法

====================忘了mysql密码,从网上找到的解决方案记录在这里====================

结束当前正在运行的mysql进程

# /etc/init.d/mysql stop

用mysql安全模式运行并跳过权限验证

# mysqld_safe --user=mysql --skip-grant-tables --skip-networking &

用空密码方式使用root用户登录 MySQL

# mysql -u root mysql

更新密码

# update user set Password = PASSWORD('root') where User ='root';

刷新权限

# FLUSH PRIVILEGES;

退出

# quit