Danh mục

Create a Database User Account

Số trang: 3      Loại file: pdf      Dung lượng: 25.92 KB      Lượt xem: 3      Lượt tải: 0    
Xem trước 2 trang đầu tiên của tài liệu này:

Thông tin tài liệu:

11,8 Tạo một cơ sở dữ liệu tài khoản người dùng đăng nhập mà bạn The tạo ra trong thế nào-Để 11,5 hoặc 11,6 cung cấp quyền truy cập vào SQL Server, nhưng không cho bất kỳ cơ sở dữ liệu trong SQL Server.
Nội dung trích xuất từ tài liệu:
Create a Database User Account 11.8 Create a Database User AccountThe logins that you created in How-To 11.5 or 11.6 provide access to SQL Server, butnot to any databases within SQL Server. This is much like giving someone a key to abuilding, but not providing keys to offices within the building.The fixed server role that you might have specified in How-To 11.7 gives the personrights to perform serverwide administrative tasks such as creating or modifyingdatabases. Using the building analogy, this is something like giving an electricianpermission to rewire or modify the electrical service within the building. However,neither of these settings actually grants access to databases within SQL Server. Before auser can access a SQL Server database (somewhat like entering a locked office in thebuilding), he must be provided with the database user account.I have been authenticated and logged into SQL Server and now I need to access data thatis stored within a SQL Server database. Without a specific database user account, I amunable to access and use data that SQL Server manages.TechniqueEnterprise Manager provides the dialog boxes that are necessary to create user accountsin any of its databases. Be sure to add the user to every database that he requires.Otherwise, the user will not be able to use the data, run stored procedures, or otherwiseaccess the database.StepsSimply logging in to SQL Server does not automatically establish a persons databaseidentity. In other words, accessing SQL Server does not mean that SQL Serverrecognizes the person as a valid database user.This is particularly true when Windows NT/2000 authentication is used. After all, thisauthentication mode means that anyone who logs in to Windows is able to access thedatabase. SQL Server needs to know exactly who the person is and what data anddatabase objects this person is allowed to access. A SQL Server user account is neededfor each user or group of users who is accessing SQL Server.Each SQL Server database maintains an internal registry of user accounts that arepermitted into the database. This information is stored in the table named sysusers withinthe database. The account information travels with the databases MDF file and is backedup when the database is backed up. 1. Open Enterprise Manager and expand the Northwind database icon. 2. Right-click on the Users icon and select New Database User from the shortcut menu that appears. Alternatively, select New Database User from the Action menu. In either case, the Database User Properties dialog box opens (see Figure 11.15). Figure 11.15. You add new user accounts with the Database User Properties dialog box. 3. Select a user or group login from the drop-down list at the top of the Database User Properties dialog box. If desired, you can provide a different username for the user account. Normally, however, youll want to avoid complications by using the default username. 4. Click the OK button to commit the new user account.CommentsIt is important to distinguish between a SQL Server login and a database user account.The SQL Server login simply allows a person to access SQL Server, but it does notprovide access to databases. A database user account provides access to one and only onedatabase that SQL Server manages. Each user, therefore, will need an account with eachdatabase he intends to use. This is why creating database user accounts for groups ofusers is much more efficient than adding user accounts for individual users.Database user accounts can be established for individual users as well as groups. TheLogin name drop-down list in the User Account Properties dialog box contains all theSQL Server logins you have created.The statement earlier that a user without a specific database account is unable to use thedatabase is not entirely correct. SQL Server declines to default user accounts: guest anddbo.The guest account is used whenever a user seeks access to the database in which he hasno specific account. Under most situations, the SQL Server system administrator hasseverely limited the ability of the default user account to access a database within SQLServer. Exactly how this is done is explained in How-To 11.10.The database owner (dbo) account owns all the objects that are created by anyone who isa member of the sysadmin fixed server role. Youll frequently see the dbo account listedas an objects owner simply because the database construction is most often left up toSQL Servers system administrators.

Tài liệu được xem nhiều: