How to assign users to a SqlServer2008 database

Source: Internet
Author: User
Reprinted from: Http://www.cnblogs.com/tonge/p/3791029.html When a project is completed, for data security, always assign a user to the database of the project, should say always create a user to manage this database, And this user can only manage this database. Have done many times, every time forget how to set, so write a blog post record.   1, log in to SQL Server with an administrator account, and create a login name (for example) in security.  2. Enter the login name, set the password, the default database selects Master, and the language defaults (such as). 3. When you are sure, open the database you want to assign permissions to, and right-click the user node in security to create a new user (for example).

Enter login name Select schema and role db_owner, this default user has access to the connection and additions and deletions. Assign a login name to the user, or create a new login in the previous step. such as
OK, OK, OK, here's a test to see if you can access the SHACDB database using the login name Scluguan you just built.

The login was successful.

Problems you may encounter when you create: Error message: "The database principal has a schema in the database and cannot be deleted."  (Microsoft SQL Server, Error: 15138) ". Error reason: Sometimes to deploy the database to the server, usually in a local backup, after uploading to the server in the restore, after the restoration of a new user will find that there is already a user (if not in the local database has been built users can ignore the problem), and the user is not deleted, can be removed by the following T-  SQL to resolve.   Workaround: Use "Your database name" Go alter authorization on the schema::d b_owner to dbo;   After execution, it is deleted manually. Reproduced please specify: http://www.cnblogs.com/tonge/p/3791029.html (respect for the fruits of others ' work)

How to assign users to a SqlServer2008 database

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.