1. 用Windows身份驗證登陸
Manage Studio -- 菜單"檔案"--"連接配接對象資料總管", 身份驗證中選擇"Windows Authentication(windows 身份驗證)"
2. 連接配接成功後, 右鍵你的執行個體(就是USER/SQLEXPRESS), 選擇"屬性"
3. 在"屬性"視窗中, 轉到"Security"(安全性)項, 在"伺服器身份驗證"中設定為"SQL Server和Windows身份驗證模式", 确定, 根據提示, 你應該重新啟動sql服務。
4. 重新啟動sql服務後, 照用Windows身份驗證連接配接, 然後執行下面的語句啟用sa使用者, 同時清除sa的密碼并且更改為sa12345。
操作方法是右鍵執行個體->選擇建立查詢->輸入下面代碼->點選"!執行"
這裡第一個null是清空密碼,第二個是新密碼,第三個是使用者名"sa"。
使用SSMS連接配接資料庫,然後打開Security->Login->sa->propertities,在properties中直接修改即可,如下圖示所示:
5. 語句執行完成後, 再用sa連接配接你的執行個體, 應該就沒有問題了.
注:當時配置完以後我用sa登陸的時候還是不行,後來重新開機電腦以後再用sa登陸就可以了。
今天使用sa用登陸sql server 2012的時候,出現如下錯誤:
A connection was successfully established with the server, but then an error occurred during the login process. (provider: Shared Memory Provider, error: 0 - No process is on the other end of the pipe.) (Microsoft SQL Server, Error: 233)
出現上述錯誤的原因是有協定沒有開,打開sqlserver configure manager,然後在sqlserver network configuration中打開tcp/ip和named piped協定,如下圖所示:
在打開上述兩個協定以後,再次使用sa使用者登入,出現如下錯誤:
Login failed for user 'username'. The user is not associated with a trusted SQL Server connection. (Microsoft SQL Server, Error: 18452)
這個錯誤就是本文标題中提到的“該使用者與可信 sql server 連接配接無關聯”錯誤,按照之前的方法再次操作一遍即可。注意要開啟“sql server and windows authentication”模式。
今天使用sa登入系統的時候出現如下錯誤:
Login failed for user 'sa'. Reason: The account is disabled. (.Net SqlClient Data Provider)
------------------------------
For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft%20SQL%20Server&EvtSrc=MSSQLServer&EvtID=18470&LinkId=20476
Server Name: .
Error Number: 18470
Severity: 14
State: 1
Line Number: 65536
按照正常方法還是無法登入,這是因為sa賬戶處于不可用狀态,修改如下:将login從Disable修改為Enable
本文轉自xwdreamer部落格園部落格,原文連結:http://www.cnblogs.com/xwdreamer/archive/2009/12/16/2297196.html,如需轉載請自行聯系原作者