mysql 忘记密码

一, 停止mysql程序

     /etc/init.d/mysqld stop  或者 kill 杀mysql的进程id

   通过安全模式启动数据库

  mysqld_safe --skip-grant-tables --skip-networking &

  查看原来数据库密码字段信息

  

   更改密码:

    5.6版本

    update mysql.user set password=PASSWORD('123') where user='root' and host='localhost';

   

   5.7版本以上

     update mysql.user set authentication_string=PASSWORD('123') where user='root' and host='10.0.0.%';  

posted on 2018-11-14 15:52  kingle-l  阅读(206)  评论(0编辑  收藏  举报

levels of contents