SQL语句中的DCL

创建用户
create user ‘用户名’@“地址” identified by ‘密码’
地址:
1、localhost,指定该用户在当前主机可以登录
2、% 任意主机登录
3、固定的ip地址

授权
grant 权限 on 数据库名.表名 to ‘用户名’@‘地址’
全部数据库为全部表为,所有数据库的所有表就是*.*
撤销权限
revoke 权限 on 数据库名.表名 from ‘用户名’@‘地址’

更改密码
set password for ‘用户名’@‘地址’ = password (‘新密码’)

删除用户
drop user ‘用户名’@‘地址’

刷新数据库
flush privileges

权限列表

  1. ALTER Allows use of ALTER TABLE.
  2. ALTER ROUTINE Alters or drops stored routines.
  3. CREATE Allows use of CREATE TABLE.
  4. CREATE ROUTINE Creates stored routines.
  5. CREATE TEMPORARY TABLE Allows use of CREATE TEMPORARY TABLE.
  6. CREATE USER Allows use of CREATE USER, DROP USER, RENAME USER, and REVOKE ALL PRIVILEGES.
  7. CREATE VIEW Allows use of CREATE VIEW.
  8. DELETE Allows use of DELETE.
  9. DROP Allows use of DROP TABLE.
  10. EXECUTE Allows the user to run stored routines.
  11. FILE Allows use of SELECT… INTO OUTFILE and LOAD DATA INFILE.
  12. INDEX Allows use of CREATE INDEX and DROP INDEX.
  13. INSERT Allows use of INSERT.
  14. LOCK TABLES Allows use of LOCK TABLES on tables for which the user also has SELECT privileges.
  15. PROCESS Allows use of SHOW FULL PROCESSLIST.
  16. RELOAD Allows use of FLUSH.
  17. REPLICATION Allows the user to ask where slave or master
  18. CLIENT servers are.
  19. REPLICATION SLAVE Needed for replication slaves.
  20. SELECT Allows use of SELECT.
  21. SHOW DATABASES Allows use of SHOW DATABASES.
  22. SHOW VIEW Allows use of SHOW CREATE VIEW.
  23. SHUTDOWN Allows use of mysqladmin shutdown.
  24. SUPER Allows use of CHANGE MASTER, KILL, PURGE MASTER LOGS, and SET GLOBAL SQL statements. Allows mysqladmin debug command. Allows one extra connection to be made if maximum connections are reached.
  25. UPDATE Allows use of UPDATE.
  26. USAGE Allows connection without any specific privileges.
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值