Kích hoạt Remote Connection cho SQL Server 2005 / 2008

Khi bạn kết nối đến SQL Server 2008 mà gặp phải các lỗi sau:
"Cannot connect to SQL-Server-Instance-Name
An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: SQL Network Interfaces, error: 28 – Server doesn’t support requested protocol) (Microsoft SQL Server)

Cannot connect to SQL-Server-Instance-Name
An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: SQL Network Interfaces, error: 26 – Error Locating Server/Instance Specified) (Microsoft SQL Server)

Cannot connect to SQL-Server-Instance-Name
Login failed for user ‘username‘. (Microsoft SQL Server, Error: 18456)"

Kích hoạt Remote Connection cho SQL Server 2005 / 2008

Đó chính là bạn chưa kích hoạt Remote Connection cho SQL Server. Để kích hoạt, bạn làm theo các bước sau:

1. Hãy bật SQL Server Browser Service lên nếu bạn chưa bật. SQL Server Browser sẽ "lắng nghe" các incoming request từ Client.
2. Hãy Enable TCP/IP Protocol cho SQL Server 2008 để chấp nhận Remote Connection.
3. Thay đổi Server Authentication thành SQL Server and Windows Authentication, bởi mặc định SQL Server 2008 chỉ cho phép bạn để ở chế độ Windows Authentication trong khi đó nếu bạn muốn dùng Remote Connection thì bạn phải để là SQL Server Authentication.
B1: Mở SQL Server Config Manager: Start --> Program --> Microsoft SQL Server 2008 --> Configuration Tools --> SQL Server Configuration Manager

B2: Trên SQL Server Configuration Manager chọn SQL Server Services --> Chọn SQL Server Browser & Start nó nếu bạn đang Stop còn không hãy làm tiếp B3

B3: Click chuột đúp vào SQL Server Browser để xem Properties chọn account để Start SQL Server Browser Service ở đây tôi để là Local Service account.

B4: Bạn chuyển tiếp qua Tab Service thay đổi Start Mode là Automatic, sau đó Click OK để hoàn tất

B5: Bên Panel bên trái, Expand SQL Server Network Configuration --> chọn Protocols for SQLEXPRESS bạn có thể thấy ngay là Protocol TCP/IP đang bị Disabled

B6: Click chuột phải chọn Enable

B7: Bạn phải Restart SQL Sevices để thay đổi có hiệu lực.


B8: Mở SQL Server Management Studio và connect vào SQL Server

B9: Click chuột phải vào SQL Server Instance và chọn Properties

B10: Chọn Security --> Chọn SQL Server and Windows Authentication mode --> OK

B11: Bạn nhận được yêu cầu phải Restart SQL Server

B12: Click chuột phải vào SQL Server Instance --> Chọn Restart

B13: Bạn đã cấu hình cho SQL Server 2008 kết nối từ xa thành công.
(Theo asp.net.vn)