zoukankan      html  css  js  c++  java
  • 在不知道MySQL帐号密码的情况下创建帐号并获得权限

    在不知道MySQL帐号密码的情况下创建帐号并获得权限

    1、 知道root帐号的情况下登录mysql系统

    mysql -h10.0.0.1 -uroot -p123 

    2、 不知道帐号可以

    a)         在一个cmd下执行mysqld-nt --skip-grant-tables,然后另外一个cmd下直接运行mysql即可直接登录。

    b)         修改my.ini跳过mysql验证。

    [mysqld]

    skip-grant-tables

    # The TCP/IP Port the MySQL Server will listen on

    port=3306

    3、 成功登录后可不修改用户密码登录其系统

    a)         保存原始密码

    Mysql>select host,user,password from mysql.user; --记录password的加密字串,如AAAA

    b)         修改用户密码

    Update mysql.user set password=”你知道密码的加密字串” –修改后可登录用户系统

    c)         还原用户原始密码

    Update mysql.user set password=”AAAA”

    d)         若用户权限较高,你可以在步骤c之前用步骤b修改的密码登录系统创高级帐号或授权。

    mysql>use mysql;
    mysql>update user set password=password('新密码') WHERE User='root'; 

    mysql>flush privileges;

    mysqladmin -u用户名 -p旧密码 password 新密码

    4、 添加新用户

    grant select,insert,update,delete on *.* to test1@"%" Identified by "abc"; 

    grant select,insert,update,delete on mydb.* to test2@localhost identified by "abc"; 

    grant select,insert,update,delete on mydb.* to test2@localhost identified by ""; 

    5、 OK,收工。

  • 相关阅读:
    Python中的时间
    Python + Selenium 自动化环境搭建过程
    HTML手写课程表,练基础
    temp2
    Jenkins配置文件
    Jenkins安装Slave节点
    Jenkins管理插件
    常见的linux上的服务重启脚本
    测试感慨
    docker的安装
  • 原文地址:https://www.cnblogs.com/flaaash/p/2651719.html
Copyright © 2011-2022 走看看