zoukankan      html  css  js  c++  java
  • Mark一下 mysql 误删除root用户的解决方法

    今天学习mysql用户管理,不小心将mysql.user表中的root用户给删掉了,然后就无法登录mysql了,网上找到了linux下的解决方法,我做了简单的修改,改成了我的windows版,恢复方法如下:

    1、关闭mysql服务
    net stop mysql 或者 wamp工具关闭
    2、启动无需验证用户的特权使用模式
    切换到mysql的bin目录,执行mysqld  --console --skip-grant-tables
    3、使用root用户登录(没有密码),重新授权
    grant all privileges on *.* to root@'localhost' identified by '密码' with grant option;
    flush privileges;
    exit
    注:如果grant 授权报错:ERROR 1290 (HY000): The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement,请先执行一次flush privileges;,然后再grant授权即可。
    4、退出特权模式(Ctrl+C)
    5、正常启动mysql,即可恢复使用
     
    网上看到的linux的恢复办法
    1、关闭mysql
    /etc/init.d/mysql stop
    2、启动无需验证用户的特权使用模式
    /usr/local/mysql/bin/mysqld_safe --user=mysql --skip-grant-tables --skip-networking &
    3、使用root用户登录(没有密码),重新授权
    mysql -uroot
    grant all privileges on *.* to root@'localhost' identified by '密码' with grant option;
    flush privileges;
    exit
    4、重启mysql服务,即可恢复使用
    /etc/init.d/mysql restart
  • 相关阅读:
    高精准加法和乘法
    高精度加法
    病毒!!!!
    真真真·高精度乘法!!!!!
    急训 Day 1 (2)
    UVA Open Credit System Uva 11078
    SPOJ 375 Query on a tree 树链剖分模板
    安卓数据包的传递 Bundle
    Android studio 如何在Activity之间传递简单的数据
    java关系运算中的控制和使用
  • 原文地址:https://www.cnblogs.com/youngerger/p/8529066.html
Copyright © 2011-2022 走看看