乡下人产国偷v产偷v自拍,国产午夜片在线观看,婷婷成人亚洲综合国产麻豆,久久综合给合久久狠狠狠9

  • <output id="e9wm2"></output>
    <s id="e9wm2"><nobr id="e9wm2"><ins id="e9wm2"></ins></nobr></s>

    • 分享

      Mysql—添加用戶并授權(quán)

       新進(jìn)小設(shè)計(jì) 2022-05-02 發(fā)布于北京
      查詢所有用戶
      -- 方式1
      mysql> select host, user, password from mysql.user;               -- 5.7版本之前的
      mysql> select host, user, authentication_string from mysql.user;  -- 5.7版本之后的,包括5.7
      
      -- 方式2
      mysql> select distinct concat('User: ''',user,'''@''',host,''';') as query from mysql.user;
      查詢用戶權(quán)限:all表示所有權(quán)限,select表示只查權(quán)限,update表示只改權(quán)限,delete表示只刪權(quán)限等。
      -- 方式1
      mysql> show grants for "user"@"host";
      mysql> show grants for "root"@"localhost";
      
      -- 方式2
      mysql> select * from mysql.user where user='root'\G;
      添加授權(quán)用戶(新創(chuàng)建的用戶,默認(rèn)情況下是沒(méi)有任何權(quán)限的):使用root用戶登錄數(shù)據(jù)庫(kù)

      命令格式如下:
      mysql> create user "用戶名"@"IP地址" identified by "密碼";

      mysql> create user "haidon" identified by "123456";       -- 此時(shí)密碼為123456,host值為%。
      mysql> create user "haidon"@"%" identified by "123456";   -- 此時(shí)密碼為123456
      分配用戶權(quán)限(給用戶授權(quán))

      命令格式如下:
      mysql> grant 權(quán)限類(lèi)型 on 數(shù)據(jù)庫(kù)名.表名 to '用戶名'@'ip地址' identified by '用戶密碼' with grant option;

      常用的權(quán)限類(lèi)型有以下幾種:
      all privileges:所有權(quán)限。
      select:讀取權(quán)限。
      create:創(chuàng)建權(quán)限。
      delete:刪除權(quán)限。
      update:更新權(quán)限。
      drop:刪除數(shù)據(jù)庫(kù)、數(shù)據(jù)表權(quán)限。

      -- 允許訪問(wèn)所有數(shù)據(jù)庫(kù)下的所有表
      mysql> grant all privileges on *.* to '用戶名'@'指定ip' identified by '用戶密碼' ;
      
      -- 允許訪問(wèn)指定數(shù)據(jù)庫(kù)下的所有表
      mysql> grant all privileges on test.* to '用戶名'@'指定ip' identified by '用戶密碼' ;
      
      -- 允許訪問(wèn)指定數(shù)據(jù)庫(kù)下的指定表
      mysql> grant all privileges on test.test to '用戶名'@'指定ip' identified by '用戶密碼' ;
      
      mysql> grant all privileges on tornado.* to 'haidon'@'%' identified by '123456';
      
      收回用戶權(quán)限(使用root用戶操作)
      mysql> revoke select on tornado.* from "haidon"@"%";
      mysql> revoke all on tornado.* from "haidon"@"%";
      
      刪除授權(quán)用戶
      mysql> drop user "haidon"@"%";                      -- 刪除方法1
      mysql> delete from mysql.user where user="haidon";  -- 刪除方法2
      
      刷新權(quán)限
      mysql> flush privileges; 
      

       https://www.cnblogs.com/sidesky/p/10650354.html

         https://www.cnblogs.com/zhangjianqiang/p/10019809.html

        本站是提供個(gè)人知識(shí)管理的網(wǎng)絡(luò)存儲(chǔ)空間,所有內(nèi)容均由用戶發(fā)布,不代表本站觀點(diǎn)。請(qǐng)注意甄別內(nèi)容中的聯(lián)系方式、誘導(dǎo)購(gòu)買(mǎi)等信息,謹(jǐn)防詐騙。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請(qǐng)點(diǎn)擊一鍵舉報(bào)。
        轉(zhuǎn)藏 分享 獻(xiàn)花(0

        0條評(píng)論

        發(fā)表

        請(qǐng)遵守用戶 評(píng)論公約

        類(lèi)似文章 更多