Sửa lỗi SQL Server login failed for user 'administrator' 18456by My Love Show 27/04/2021, 8:24 AM | 27/04/2021, 8:24 AM | 5.9K | 030124 Trong quá trình làm việc với SQL Server nếu bạn gặp trường hợp không thể đăng nhập được vào SQL Server bằng cả quyền Windows lẫn 'sa' thì bạn có thể làm theo hướng dẫn trong video dưới đây. Lỗi này thường xảy ra khi bạn thay đổi tên của máy tính, các bước làm lần lượt như sau : - Mở SQL Server Configuration Manager, đường dẫn tham khảo :
- Chọn mục * Chi tiết bạn xem video dưới đây: Encountering the “Login failed for user ‘sa’. (Microsoft SQL Server, Error 18456)” error can be a frustrating experience for database administrators and developers. This error typically occurs when there’s a problem with the authentication process. In this blog, we will explore some common reasons for this error and solutions to fix it. Let’s dive in! Solution 1: Verify Username and PasswordDouble-check the username and password. It’s possible that either the username is misspelled or the password has been changed without updating your connection string. Solution 2: Check SQL Server authentication modeEnsure that your SQL Server is configured to allow SQL Server authentication. Without that, it won’t allow the login with login name and password. To change the authentication mode, follow these steps: 1. Connect to SQL Server using a Windows Authentication account with administrative privileges. 2. Open SQL Server Management Studio (SSMS) and right-click on the server instance and select “Properties”. 3. Navigate to the “Security” tab. Choose “SQL Server and Windows Authentication mode”. Click on “OK” to save the changes. 4. Right-click on the server instance and select “Restart” to restart the SQL Server service. Solution 3: Reset ‘sa’ PasswordIf you suspect that the ‘sa’ account’s password is incorrect, you can reset it. If you have administrative privileges on the SQL Server instance, follow these steps: 1. Log in to SQL Server using Windows Authentication. 2. Expand the “Server instance” and then “Security”. Inside “Security” expand “Logins”. Right click on ‘sa’ and select “Properties”. 3. Reset the password. Solution 4: Verify SQL Server ServicesSometimes, the error 18456 can occur if the SQL Server services are not running correctly. To check and start the services, do the following: 1. Press “Win + R,” type “services.msc,” and press Enter. 2. Look for “SQL Server” in the list of services. 3. Ensure that the status of service is “Running.” If not, right-click on the service and select “Start.” Solution 5: Unlock the ‘sa’ loginIf multiple failed login attempts occur, the ‘sa’ login account might get locked out. To unlock the ‘sa’ account, follow these steps: 1. Connect to SQL Server using a Windows Authentication account with administrative privileges. 2. Expand the “Server instance” and then “Security”. Inside “Security” expand “Logins”. Right click on ‘sa’ and select “Properties”. 3. In the “Status” tab, check the “Login” option. Check the “Enabled” option, if it’s not checked. 4. Click “OK” to apply the changes. Conclusion:The “Login failed for user ‘sa’. (Microsoft SQL Server, Error 18456)” error can stem from various sources, ranging from incorrect credentials to database configuration problems. By systematically following the solutions outlined in this blog post, you can troubleshoot and resolve the issue, ensuring smooth access to your SQL Server instance. Remember that each environment may have unique factors contributing to the error, so patient investigation is key to finding an effective solution. |