• mysql 权限管理 记录


    授权操作只能用root账号,其他账号都不行

    创建一个mike账号

    mysql> create user 'mike'@'localhost' identified by '123';
    Query OK, 0 rows affected (0.08 sec)

    查看是否创建账号

    select * from mysql.userG;

    默认创建账号 在user表里没有放行授权 红色框是权限

     但这个账号在其他表会有权限 例如 db表

    select * from mysql.dbG;

    user 是空的 包括任意用户,包括创建的mike账号  ,在db表里都有权限

    HOST %  代表包括任意ip ,包括远程和本地

    mike这个用户 对test这个库有权限,还对test_开头的库有权限

    创建两个库测试下

    mysql> create database test_1 charset=utf8;
    Query OK, 1 row affected (0.13 sec)
    
    mysql> create database test2 charset=utf8;
    Query OK, 1 row affected (0.00 sec)

    退出重新登录

    mysql> exit
    Bye
    [root@mysql ~]# mysql -umike -p123
    Warning: Using a password on the command line interface can be insecure.
    Welcome to the MySQL monitor.  Commands end with ; or g.
    Your MySQL connection id is 2
    Server version: 5.6.36 Source distribution
    
    Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
    
    Oracle is a registered trademark of Oracle Corporation and/or its
    affiliates. Other names may be trademarks of their respective
    owners.
    
    Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.
    
    mysql> 

     没有test2库,可以看到test、test_1数据库,可以对test、test_1数据库,里面的表进行增删改查

    mysql> show databases;
    +--------------------+
    | Database           |
    +--------------------+
    | information_schema |
    | test               |
    | test_1             |
    +--------------------+
    3 rows in set (0.05 sec

    db表默认对test库放行权限,默认如果想针对某个库,就要对db这张表授权了

  • 相关阅读:
    WPF中各个Template的分析(转)
    WPF TreeView
    微信支付文章综合
    WPF 颜色渐变
    史上最全的厦门英语角!赶紧收藏啦!
    SQL008存储过程总结
    SQL SERVER事务处理
    HTTP 头部解释
    为你详细解读HTTP请求头的具体含意
    IIS部署常见问题总结
  • 原文地址:https://www.cnblogs.com/mingerlcm/p/9925394.html
Copyright © 2020-2023  润新知