MySQL语法模板 SQL语句:权限

  1. 创建用户
CREATE USER user [IDENTIFIED BY [PASSWORD] 'password']
  1. 删除用户
DROP USER user [, user] ...
  1. 刷新权限
FLUSH PRIVILEGES
  1. 分配权限
    GRANT priv_type,...
    ON [object_type] {tbl_name | * | *.* | db_name.*}
    TO user [IDENTIFIED BY [PASSWORD] 'password']
        [, user [IDENTIFIED BY [PASSWORD] 'password']] ...
    [WITH with_option]
  1. 用户名称重命名
RENAME USER old_user TO new_user
    [, old_user TO new_user] ...
  1. 收回权限
REVOKE priv_type, ...
    ON [object_type] {tbl_name | * | *.* | db_name.*}
    FROM user [, user] ...
  1. 收回全部权限
REVOKE ALL PRIVILEGES, GRANT OPTION FROM user [, user] ...
  1. 设置新密码
SET PASSWORD FOR user = PASSWORD('some password')
    原文作者:liuawei
    原文地址: https://www.jianshu.com/p/ccbb57597db4
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞