Security1:Create Login

Login 用于登陆SQL Server

1,Create Sql Server login

CREATE LOGIN TestLoginName
with password=‘J345#$)thb‘
,DEFAULT_DATABASE = db_study

PASSWORD =password

Applies to SQL Server logins only. Specifies the password for the login that is being created. You should use a strong password. For more information see Strong Passwords and Password Policy.

Passwords are case-sensitive. Passwords should always be at least 8 characters long, and cannot exceed 128 characters.  Passwords can include a-z, A-Z, 0-9, and most non-alphanumeric characters. Passwords cannot contain single quotes, or the login_name.

DEFAULT_DATABASE =database

Specifies the default database to be assigned to the login. If this option is not included, the default database is set to master.

DEFAULT_LANGUAGE =language

Specifies the default language to be assigned to the login. If this option is not included, the default language is set to the current default language of the server. If the default language of the server is later changed, the default language of the login remains unchanged.

2,Creating a login from a Windows domain account

CREATE LOGIN [<domainName>\<login_name>]
FROM WINDOWS;

login_name

Specifies the name of the login that is created. When you are creating logins that are mapped from a Windows domain account, you must use the pre-Windows 2000 user logon name in the format [<domainName>\<login_name>].

3,Next Steps

After creating a login, the login can connect to the Database Engine, but only has the permissions granted to the public role. Consider performing the some of the following activities.

参考文档:

https://msdn.microsoft.com/en-us/library/ms189751(v=sql.110).aspx

时间: 2024-08-09 14:45:43

Security1:Create Login的相关文章

execute as login 切换上下文

作为DBA,可能经常需要帮助Developer排除有关权限的问题.要确认某个账号是不是已经拥有了某权限,DBA并不需要使用该账号的登录名和密码进行验证,只需使用execute as语句,将当前会话的上下文切换到指定的login(登录)或者user(用户),就可以验证该账号是否拥有某权限. execute as user='user_name' 该语句模拟的上下文是当前数据库中的user,模拟范围仅限于当前数据库,任何对该数据库以外的资源的访问尝试都会导致失败,不管该user是否拥有相应权限. e

Server级别触发器之login

一EVENTDATA EVENTDATA记录登录的相关属性 只有直接在 DDL 或登录触发器内部引用 EVENTDATA 时,EVENTDATA 才会返回数据.如果 EVENTDATA 由其他例程调用(即使这些例程由触发器进行调用),则它将返回 NULL. 在隐式或显式调用 EVENTDATA 的事务提交或回滚之后,EVENTDATA 所返回的数据将无效. 二登陆触发器 SQL Server 2005 登录触发器将为响应 LOGON 事件而激发存储过程.与 SQL Server 实例建立用户会话

在sql server中创建一个只读login

在SQL Server中创建一个Login,并为这个login授予只读的权限 --create Login Name create login [domain\login] from windows; --create --UserName Create User DWReadOnly for login [domain\login] --Grant readonly ALTER ROLE [db_datareader] add MEMBER DWReadOnly Appendix 服务器角色参

Security3:Create Schema

Creates a schema in the current database The new schema is owned by one of the following database-level principals: database user, database role, or application role. Objects created within a schema are owned by the owner of the schema, and have a NU

SQL Server 服务器器信息备份(一)--login新建脚本备份

前言 若你的企业使用SQL Server数据库镜像为容灾技术. 那你一定做过在镜像切换之前要新建Login,而且若Login密码不同,要修改链接数据库的字符串,在切换完之后则仍需要给数据库重新赋予权限. 若真的是这样做,不仅麻烦而且业务故障时间将会拉长,我们需要做到新建的Login与之前的密码完全一样,而且可自动根据原有数据库用户链接到Login,数据库级别权限不用从新处理. 思路 有了这样的思路则Login的信息备份需要考虑两点: 1.一定要获取用户的SID,以保证镜像切换后能自动连接到log

How to add the ApplicationPoolIdentity to a SQL Server Login

The ApplicationPoolIdentity is a virtual account in Windows that is dynamically generated when the application pools is created and takes on the name of the application pool in this manner: IIS Apppool\<name of application pool> . For instance, the

SQL Server-服务器迁移之后login登录问题

1.服务器迁移之后,将原来的系统数据库覆盖到新的server,用当前windows account出现无法登录的现象,这时有以下几个方法: (1)在原机器上添加新的账号并赋予管理员的权限,然后迁移到新机器: (2)以单用户的模式登录,创建新的login: 1)迁移完成之后,停止sql服务: 2)运行cmd,输入:'net start MSSQLSERVER /m'(默认实例) 3)如果是命名实例:'net start 实例名 /m' 4)连接到sql,使用:SQLCMD -E -S<server

SSAS 发布报错处理方法 Login failed for user &#39;NT Service\MSSQLServerOLAPService&#39; 28000

Create login and grant access: Open up SQL Server Management Studio [login to the database engine]> Security > Login (Right click) > New Login >add user: "NT Service\MSSQLServerOLAPService">select the database being analyzed in th

SQL Server Always On 切换主机Login和User无法匹配解决方案

SQL SERVER Always On切换主机之后Login和User无法匹配,找了好久没有找到解决方案,后来询问微软,说是因为LOGIN中创建Login主机SQL Server实例的SID,因为服务器之前SQL Server实例的SID不同,导致无法匹配. 解决方案如下:首先在一台主机中创建Login和User,用下面的两个SP跑出带SID的Login脚本,拿产生的脚步分别在辅助服务器上运行,产生带SID的login,这样所有服务器SQL Server实例中的Login所带的SID都是一样的