mysql密码重置

首先将mysql停止

然后使用下面命令安全启动mysql

mysqld_safe --skip-grant-tables &

 之后使用不用密码即可直接进入mysql数据库

mysql -uroot

 最后在mysql库中使用update更改root的密码

update mysql set password=('xxxxx') where user='root';
flush privileges;

 注意:在mysql 5.7 之后user表中没有password改用authentication_string代替,用如下方法修改密码

 

update authentication_string=password('xxxx') where user='root'

 

posted @ 2017-09-19 15:33  yqyqy  阅读(123)  评论(0)    收藏  举报