mysql安全模式重置密码

 

  1. 停掉MariaDB服务:

    systemctl stop mariadb
    sudo mysqld_safe --skip-grant-tables --skip-networking &
  2. 直接用root登录,无需密码:
    mysql -u root
  3. 重设密码:
    mysql> use mysql;  
    mysql> update user set password=PASSWORD("passw@rd") where User='root';
    mysql> flush privileges;
  4. 重启服务:
    systemctl restart mariadb
  5. 用新密码登录了:
    mysql -u root -ppassw@rd
posted @ 2017-10-10 18:40  枫叶那个飘啊  阅读(209)  评论(0编辑  收藏  举报