[SQL Server] how to add a domain account as a database user

Source: Internet
Author: User
1. Create the login

First create a SQL Server login for your domain account.

Create login [your domain account] from windows;

Go

Your domain account has to be replaced with the domain account you want to add. for instance your domain is called Darth and the user Vader than it wocould be create login [Darth \ VADER] from windows; go;

To check if the login was successfully created type in

Select name from SYS. server_principals

Go

And the domain user shoshould appear in the result list.

2. Grant SysAdmin rights

You can retrieve a list of server roles usingSp_helpsrvroleProcedure. So to add the user toSysAdminServer role group type the following (example is still domain Darth user Vader)

SP_ADDSRVROLEMEMBER 'darth \ Vader ', 'sysadmin'

Go

Done.

Quit sqlcmd and open a non elevated instance with your domain account. Type in select user_name () and the result shocould be DBO.

Reference from: http://blogs.msdn.com/dparys/archive/2009/09/17/create-database-permission-denied-in-database-master-my-fix.aspx

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.