Method for changing the user name of the SA in SQL Server 2005 _mssql2005

Source: Internet
Author: User
Tags microsoft sql server microsoft sql server 2005 management studio microsoft sql server management studio sql server management sql server management studio

The code to modify the database sa account name is as follows:

Copy Code code as follows:

Alter LOGIN SA DISABLE
Alter LOGIN sa with NAME = [Systemaccount]

"Systemaccount" is the new name for the SA, and when the execution is complete, refresh the right login to see the name of the account that was successfully modified.

SQL Server 2005 How to modify the SA user password The graphic version

How to modify the SA user password in SQL Server 2005

1. Click "Start-All Programs-Microsoft SQL Server 2005-configuration Tools-SQL Server Configuration Manager", open SQL Server Configuration Manager Window As shown in the following illustration:

2. Open the "SQL Server 2005 Network Configuration" and click the "SQL2005 protocol (here, use the instance name of our installation)" item, as shown in the following illustration:

3. On the right side of the "Named pipes" above the right mouse button, click on the Pop-up submenu "Enable" Command, pop-up "Warning" dialog box. As shown in the following illustration:

4. Click "OK" button.

5. Open "SQL Native Client Configuration" and click on the "Clients agreement" item. As shown in the following illustration:

6. Click the right mouse button on the right side of the "Named pipes" and click "Enable" on the Pop-up submenu. Close the SQL Server Configuration Manager window.

7. Click Start-All Programs-Microsoft SQL Server 2005-sql server Management Studio and select Windows Authentication in the Connect to server window. As shown in the following illustration:

8. Click the "Connect" button and log in to Microsoft SQL Server Management Studio.

9. In the Object Explorer window, right-click the instance name (SQL Server 9.0.5000) and select Properties on the Pop-up submenu. As shown in the following illustration:

10. Open the Server Properties window. As shown in the following illustration:

11. Select the security item in the Select page, select the SQL Server and Windows authentication mode entry in Server Authentication, and then click OK.

12. In the Object Explorer window, open the security entry, open the login name entry, right-click on the SA, and select Properties from the Pop-up submenu. As shown in the following illustration:

13. Open the Login Properties window. As shown in the following illustration:

14. After changing the password, remove the "Enforce password policy" before the Tick (√), click the "OK" button.

At this point, the password for the SA user in SQL Server 2005 was modified successfully!

15. Start SQL Server Management Studio, and in the Connect to Server dialog box, you can choose SQL Server Authentication. As shown in the following illustration:

16. Enter "SA" in the "Login name" box, enter the modified password, and then click the "Connect" button to successfully start SQL Server Management Studio!


Using SQL statements to modify the password of the SA user in SQL Server 2005
First, start SQL Server Management Studio by using Windows authentication.
Second, in the Server Properties window, select the SQL Server and Windows authentication mode entry.
Then, cancel the Enforce password policy entry.

Finally, execute one of the following code in new query:

Code One:

ALTER LOGIN SA ENABLE; Go ALTER LOGIN sa with PASSWORD = ' PASSWORD '; Go

Code two:

ALTER LOGIN sa with PASSWORD = n ' new password '--can be used in this way: with PASSWORD = N ' 123456 ' old_password = n ' old password '

Code Three:

ALTER LOGIN [SA] with password=n ' newpassword '--you can not provide the old password--alter login [sa] with password=n ' 123456 '


Third, related reading
SQL Server 2000 ways to modify the sa password

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.