I installed Microsoft SQL server 2012. I open Microsoft SQL server management and login with Windows Authentication. I don't know the default password of "sa". So, I need to change it. I follow steps from the answer to this question: Unable to change the password of "sa" in SQL Server 2008 but the password doesn't change!
For better sense see these screenshots in order:
1. I select logins. After, I select "sa". Then, select "Properties".
Some Unsuccessful Tries
UPDATE
The first I said length of the password isn't correct. But I have noticed the length of the password isn't real length for the security aspect. I edit step 4 with a better reason for my claim
UPDATE 2
I open logs: It seems my authentication mode is wrong:
Login failed for user 'sa'. Reason: An attempt to login using SQL authentication failed. The server is configured for Windows authentication only. [CLIENT: ]
But I change authentication mode before:
SQL Server and windows Authentication mode
UPDATE 3
Finally, my problem was solved! The reason for my problem is wrong changing authentication mode. The answer of Larnu is a good solution. Also, I suggest this link for step by step guide: How To Enable SQL Server Authentication
The real problem here is that you have your server configured in Windows authentication only. You cannot connect to an instance using SQL Authentication if it's in Windows Authentication only mode, because (to state the obvious) SQL Authentication is not Windows Authentication.
You need to change the authentication mode of the server:
Enable sa login
You can enable the sa login with SSMS or T-SQL.
Use SSMS
- In Object Explorer, expand Security, expand Logins, right-click sa, and then click Properties.
- On the General page, you might have to create and confirm a password for the sa login.
- On the Status page, in the Login section, click Enabled, and then click OK.
Using Transact-SQL
The following example enables the sa login and sets a new password. Replace with a strong password before you run it.
ALTER LOGIN sa ENABLE ; GO ALTER LOGIN sa WITH PASSWORD = '<enterStrongPasswordHere>' ; GO
Change authentication mode (T-SQL)
The following example changes Server Authentication from mixed mode (Windows + SQL) to Windows only.
Caution
The following example uses an extended stored procedure to modify the server registry. Serious problems might occur if you modify the registry incorrectly. These problems might require you to reinstall the operating system. Microsoft cannot > guarantee that these problems can be resolved. Modify the registry at your own risk.
USE [master] GO EXEC xp_instance_regwrite N'HKEY_LOCAL_MACHINE', N'Software\\Microsoft\\MSSQLServer\\MSSQLServer', N'LoginMode', REG_DWORD, 1 GO
For mixed authentication, the final parameter would be 2
, not 1
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.