Connect to SQL Server from Windows Vista

[本文档仅供预览,在以后的版本中可能会更改。空白主题作为占位符包含在内。]

This topic describes how to The Windows Vista operating system provides a new security feature named User Account Control (UAC). in Microsoft SQL Server 2012 Release Candidate 0 (RC 0) by using SQL Server Management Studio, Transact-SQL, or PowerShell. User Account Control lets users perform common tasks as non-Administrators. Windows user accounts that are members of the local Administrators group can run most applications as if they using the Standard User account.

Using the Standard User account helps protect the system because all applications that are run by administrators in Windows Vista do not have full administrator permissions. Programs that do require administrator permissions, such as tools to administer the system, are started with administrator permissions after the user provides consent.

SQL Server installs with the BUILTIN\Administrators group as the default system administration group. By default, users on Windows Vista that are members of the Windows Administrators group are not automatically granted permission to connect to SQL Server, and they are not automatically granted SQL Server administrator privileges. On Windows Vista, when a user tries to connect to SQL Server, a message is returned that states that the account does not have rights to log in to SQL Server.

备注

In SQL Server Express, Windows users are granted connect permission because the BUILTIN\Users group is provided as a login.

When a user in the Administrators account runs SQL Server Management Studio, the User Account Control feature strips the membership token for that group and passes only the user account information to SQL Server. A message is returned that states that the account does not have rights to log in to SQL Server. To let members of the Windows Vista Administrators group log in, you must explicitly add the account to the SQL Server logins.

备注

If you use the format username@domain when you log on to Windows Vista, you might see a SQL Server login failure or an access denied message. To resolve this issue, use one of the following formats to log in to Windows Vista: domain\username or username@fully_qualified_domain.

In This Topic

  • Before you begin:

    Limitations and Restrictions

    Prerequisites

    Recommendations

    Security

  • To ReplaceThisText, using:

    SQL Server Management Studio

    Transact-SQL

    PowerShell

  • Follow Up:  After ReplaceThisText

Before You Begin

Limitations and Restrictions

  • Replace this text.

Prerequisites

  • Replace this text.

Recommendations

  • Replace this text.

Security

Permissions

用于“返回首页”链接的箭头图标[Top]

Using SQL Server Management Studio

To add a Windows user that has the login "machinename\Administrator" to the sysadmin fixed server role

  1. Log on to the computer using the credentials for the machinename\Administrator account.

  2. Click the Start button, point to All Programs, click Microsoft SQL Server, and then click SQL Server Management Studio.

  3. Connect to an instance of SQL Server.

  4. Click Security, right-click Logins, and then click New Login.

  5. In the Login name box, enter the user name.

  6. In the Select a page pane, click Server Roles, select the sysadmin check box, and then click OK.

To add a Windows user that has the login "domainname \username" to the sysadmin fixed server role

  1. Log on to the computer using the credentials for the domainname\username account.

  2. Click the Start button, point to All Programs, click Microsoft SQL Server, right-click SQL Server Management Studio, and then click Run as administrator.

    备注

    The Run as administrator option elevates the user permissions.

  3. In the User Access Control dialog box, click Continue.

  4. In SQL Server Management Studio, connect to an instance of SQL Server.

  5. Click Security, right-click Logins, and then click New Login.

  6. In the Login name box, enter the user name.

  7. In the Select a page pane, click Server Roles, select the sysadmin check box, and then click OK.

用于“返回首页”链接的箭头图标[Top]

Using Transact-SQL

To ReplaceThisText

  1. Connect to ReplaceThisText.

  2. Use the ReplaceThisText statement, as follows:

    ReplaceThisText

    where ReplaceThisText .

    The following example ReplaceThisText.

    ReplaceThisText ;
    

Example (Transact-SQL)

用于“返回首页”链接的箭头图标[Top]

Using PowerShell

To ReplaceThisText

备注

For an example of this procedure, see Example (PowerShell), later in this section.

  1. CD to ReplaceThisText.

  2. Use the ReplaceThisText cmdlet, as follows:

    ReplaceThisText

    where ReplaceThisText .

    The following example ReplaceThisText .

    ReplaceThisText
    
  1. Open a ReplaceThisText and connect to an instance of the 数据库引擎.

  2. Use the ReplaceThisText object to ReplaceThisText.

  3. The following example ReplaceThisText.

    ReplaceThisText
    

Example (PowerShell)

The following example ReplaceThisText.

ReplaceThisText

用于“返回首页”链接的箭头图标[Top]

Follow Up: After ReplaceThisText

用于“返回首页”链接的箭头图标[Top]

请参阅

概念

创建数据库用户