SQL Server Express默认是不安装Management Studio的,如果在部署应用程序的时候,需要开启SQL Server Express的远程连接,又不想用户干涉,则需要编程修改如下位置的的注册表的值:
Important This section, method, or task contains steps that tell you how to modify the registry. However, serious problems might occur if you modify the registry incorrectly. Therefore, make sure that you follow these steps carefully. For added protection, back up the registry before you modify it. Then, you can restore the registry if a problem occurs. For more information about how to back up and restore the registry, click the following article number to view the article in the Microsoft Knowledge Base:
322756 (http://support.microsoft.com/kb/322756/ ) How to back up and restore the registry in Windows
If you are not sure how to verify the authentication mode of your MSDE installation, you can check the corresponding registry entry. By default, the value of the Windows LoginMode registry subkey is set to 1 for Windows Authentication. When Mixed Mode authentication is enabled, this value is a 2.
- The location of the LoginMode subkey depends on whether you installed MSDE as the default MSDE instance or as a named instance. If you installed MSDE as the default instance, the LoginMode subkey is located in the following registry subkey:
HKLM\Software\Microsoft\MSSqlserver\MSSqlServer\LoginMode
Note If you are using SQL Server 2005, whatever you installed a default instance or a named instance, locate the following registry subkey. MSSQL.x is a placeholder for the corresponding value for your system:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL.x\MSSQLServer
- If you installed MSDE as a named instance, the LoginMode subkey is located in the following registry subkey:
HKLM\Software\Microsoft\Microsoft SQL Server\%InstanceName%\MSSQLServer\LoginMode
-
Note Before you switch authentication modes, you must set a sa password to avoid exposing a potential security hole.
To switch from Mixed Mode to Integrated (Windows) authentication, follow these steps: -
- To stop MSSQLSERVER and all other related services (such as SQLSERVERAgent), open the Services applet in Control Panel.
- Open the Registry Editor. To open the Registry Editor, click Start, click Run, and then type: "regedt32" (without the quotation marks)
Click OK. - Locate either of the following subkeys (depending on whether you installed MSDE as the default MSDE instance or as a named instance:
HKEY_LOCAL_MACHINE\Software\Microsoft\MSSqlserver\MSSqlServer
or
HKEY_LOCAL_MACHINE\Software\Microsoft\Microsoft SQL Server\<Instance Name>\MSSQLServer\
- In the right-pane, double-click the LoginMode subkey.
- In the DWORD Editor dialog box, set the value of this subkey to 1. Make sure that the Hex option is selected, and then click OK.
- Restart the MSSQLSERVER and the SQLSERVERAgent services for this change to take effect.