码迷,mamicode.com
首页 > 数据库 > 详细

mysql授权、删除用户和角色权限

时间:2018-03-02 14:54:59      阅读:341      评论:0      收藏:0      [点我收藏+]

标签:数据   from   creat   base   data   shutdown   family   backup   reply   

 

备份权限

GRANT USAGE ON *.* TO backup@172.16.0.157 IDENTIFIED BY PASSWORD *38B4F16EADB1601E713D9F03F1DFA1F71C624A91;

#GRANT USAGE ON *.* TO backup@172.16.0.157 IDENTIFIED BY  123456;

GRANT SELECT, LOCK TABLES, SHOW VIEW, TRIGGER ON `pccb_pre`.* TO backup@172.16.0.157;

zabbix监控权限

GRANT SELECT ON *.* TO zabbix@172.16.0.155 IDENTIFIED BY PASSWORD *89AF6F71DE54E02F7D150CD66166A345C89DA896
或 GRANT USAGE ON *.* TO ‘zabix‘@‘%‘ IDENTIFIED BY PASSWORD ‘*A15001023857EC31A1C5B477A8C75B2DDE18C7EE‘


授权

#所有权限
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, TRIGGER ON *.* TO root@192.168.80.4 identified by 123123123;

#授权某两张表
GRANT USAGE ON *.* TO pccbnbbs_r@172.16.0.159 IDENTIFIED BY  jdt7zrLyuPrsizcfb.6t ;给上海李小明
GRANT SELECT ON `pccb_nbbs`.`article` TO pccbnbbs_r@172.16.0.159;                                      
GRANT SELECT ON `pccb_nbbs`.`article_reply` TO pccbnbbs_r@172.16.0.159;

all :表示所有操作增删改查
库名:表示针对库具有的操作权限,任何库使用*
表名:表示针对库中表具有的操作权限,任何表使用*
user:登录用户名
192.168.1.%:表示允许192.168.1这个网段的所有机器都具有登录权限。如果想任何电脑登录使用%
identified by :设置登录密码
授权完要权限刷新,就是让权限数据写入内存
mysql> flush privileges;

权限回收

revoke select,delete on db.table from user@%

revoke all privileges on *.* from 3156dev@%;

查看授权

select user,host from mysql.user where user=root;
show grants for user@%; #查看用户有哪些权限

删除用户

DROP USER backup@172.16.0.157;

 

mysql授权、删除用户和角色权限

标签:数据   from   creat   base   data   shutdown   family   backup   reply   

原文地址:https://www.cnblogs.com/hanxiaohui/p/8492371.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!