忘记mysql的root密码怎么办

 1. KILL掉系统里的MySQL进程;
2.
用以下命令启动MySQL,以不检查权限的方式启动;
mysqld_safe --skip-grant-tables &
3.
然后用空密码方式使用root用户登录 MySQL
mysql -u root
4.
修改root用户的密码;
mysql> update mysql.user set password=PASSWORD('
新密码') where User='root';
mysql> flush privileges;
mysql> quit
5.
重新启动MySQL,就可以使用新密码登录了。
给数据赋权必须用root用户
(
赋权给本地用户)grant all on mysql.* to extmail@"localhost" identified by "your_password" with grant option;



文章来自: 本站原创
Tags:
评论: 0 | 查看次数: 4798