• SQL Server 数据库安全相关(SQL语句)


    -- 创建登陆用户
    -- 语法: create login login_name from windows with default_database = database | default_language = language
    create login [localhost\hoojo-pc] from windows with default_database = testHome;
     
    -- 创建登陆用户
    -- 语法: create login login_name with password = 'pwd' [hashed] [must_change] [check_expiration] [check_policy]
    create login admin with password = '123456', default_database = testHome;
     
    -- 查看登陆用户
    select * from sys.sql_logins;
     
    -- 修改用户
    alter login admin with name = jackson;
    alter login jackson with password = 'abcd';
     
    -- 禁用、启用用户
    alter login jackson disable;
    alter login jackson enable;
     
    -- 删除用户
    drop login jackson;
     
    -- 修改映射凭据(将登录名 MacraeS 映射到凭据 Custodian04)
    alter login jackson with credential = Custodian04;
     
     
    -- 启动 guest 用户(不推荐使用)
    -- 特殊用户 dbo、guest;sa 对应dbo用户,其他没有映射的用户就是guest用户
    grant connect to guest;
     
    -- 修改用户
    alter user jack with name = jason;
    alter user jason with default_schema = jason_schema;
     
    -- 删除用户
    drop user jason;
     
    -- 给jack用户授权buyers角色
    create role buyers authorIzation jack;
     
    -- 修改角色
    alter role buyers with name = new_buyers;
    -- 删除角色
    drop role new_buyers;
     
     
    -- 架构管理
    -- 创建
    create schema temp_schema;
    -- 指定用户
    create schema jason_scheam authorization jason;
    -- 授权查询
    grant select to jason;
    -- 删除
    drop schema jason_scheam;
    -- 授权创建table
    grant create table to jason;
    -- 授权jason查询student表
    grant select on student to jason;
    -- 收回权限
    revoke create table to jason;
    revoke select on student to jason;
  • 相关阅读:
    golang 相关
    ES root用户启动失败can not run elasticsearch as root
    基于 Flink CDC + Hudi 湖仓一体方案实践
    数据平台上云
    多云趋势
    数果实时数仓探索
    宽表的设计
    数仓指标体系
    Hudi在医疗大数据的应用
    Hudi on Flink上手使用总结
  • 原文地址:https://www.cnblogs.com/SkySoot/p/2441378.html
Copyright © 2020-2023  润新知