12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
ADADADADAD
mysql数据库 时间:2024-12-25 09:57:53
作者:文/会员上传
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
标题索引官方帮助常用案例官方帮助在使用数据库时必不可少的即是查看help帮助,通过help帮助再次寻找常用命令及参数,如下为help grant信息:MariaDB[(none)]>helpgrant;Name:
以下为本文的正文内容,内容仅供参考!本站为公益性网站,复制本文以及下载DOC文档全部免费。
标题索引
官方帮助
常用案例
官方帮助
在使用数据库时必不可少的即是查看help帮助,通过help帮助再次寻找常用命令及参数,如下为help grant信息:
MariaDB[(none)]>helpgrant;Name:'GRANT'Description:Syntax:GRANTpriv_type[(column_list)][,priv_type[(column_list)]]...ON[object_type]priv_levelTOuser_specification[,user_specification]...[REQUIRE{NONE|ssl_option[[AND]ssl_option]...}][WITHwith_option...]GRANTPROXYONuser_specificationTOuser_specification[,user_specification]...[WITHGRANTOPTION]object_type:TABLE|FUNCTION|PROCEDUREpriv_level:*|*.*|db_name.*|db_name.tbl_name|tbl_name|db_name.routine_nameuser_specification:user[IDENTIFIEDBY[PASSWORD]'password'|IDENTIFIEDWITHauth_plugin[AS'auth_string']]Normally,adatabaseadministratorfirstusesCREATEUSERtocreateanaccount,thenGRANTtodefineitsprivilegesandcharacteristics.Forexample:CREATEUSER'jeffrey'@'localhost'IDENTIFIEDBY'mypass';GRANTALLONdb1.*TO'jeffrey'@'localhost';GRANTSELECTONdb2.invoiceTO'jeffrey'@'localhost';GRANTUSAGEON*.*TO'jeffrey'@'localhost'WITHMAX_QUERIES_PER_HOUR90;
常用配置
1.授权单位普通DBA或运维人员增删改查命令
MariaDB[(none)]>createtableperformance(idint,server_namevarchar(20),Adress_Cityvarchar(30));MariaDB[(none)]>grantselect,update,delete,insertoncluster.performancetoroot@'172.18.0.%'identifiedby'jncsy';QueryOK,0rowsaffected(0.00sec)MariaDB[(none)]>flushprivileges;
2.授权某个用户某张表的某几列查询命令
MariaDB[(none)]>grantselect(id,server_name)oncluster.performancetoroot@'172.18.0.%'identifiedby'jncsy';QueryOK,0rowsaffected(0.00sec)MariaDB[(none)]>flushprivileges;
3.撤销某用户的授权权限
MariaDB[(none)]>showgrantsforroot@'172.18.0.%';+--------------------------------------------------------------------------------------------------------------+|Grantsforroot@172.18.0.%|+--------------------------------------------------------------------------------------------------------------+|GRANTUSAGEON*.*TO'root'@'172.18.0.%'IDENTIFIEDBYPASSWORD'*429B3FB345D35EC8C8B54230AD060C07E846494A'||GRANTSELECT,INSERT,UPDATE,DELETEON`cluster`.`performance`TO'root'@'172.18.0.%'|+--------------------------------------------------------------------------------------------------------------+2rowsinset(0.00sec)MariaDB[(none)]>revokeselectoncluster.performancefromroot@'172.18.0.%';QueryOK,0rowsaffected(0.00sec)
11-20
11-19
11-20
11-20
11-20
11-19
11-20
11-20
11-19
11-20
11-19
11-19
11-19
11-19
11-19
11-19