Topic lessonTopic: SQL Server connection troubleshooting
Cannot connect to SQL Server: network, TLS, authentication and permissions
Investigate SQL Server connection failures by matching the target, client and observed error from one attempt. Separate TCP reachability, TLS certificate validation, login, database access and SQL permissions before deciding what to change.
Identify the failed and unverified stages and choose a next check for the same source, target, identity and time.
A login identifies access at connection time; a database user acts within a database, with permissions for operations such as SELECT. Wording varies by client/version. The observations below are fictional; no probe or login is performed.
First identify the attempt being investigated
| Record | Fictional value | Purpose |
|---|---|---|
| Source/time | client-A / T1 | Distinguish other clients, paths and times |
| Target | tcp:sql-lab.example.invalid,1433 | Fix name, protocol and port |
| Client | SSMS release and settings | Distinguish the application driver |
| Identity/database | SQL authentication / reader_demo / CorpDocs | Record method and target, not secret values |
| Observation | TCP succeeded; certificate name validation failed | Login and SELECT remain unverified |
example.invalid is a non-working documentation name; 1433 is stipulated, not a claim that every SQL Server uses that port. Even on one computer, SSMS and an application may use different drivers, identities and encryption settings.
Read what an error does and does not establish
- Name and reachability → TLS and loginReaching the target leaves later checks separate
- TLS and login → Database and actionAuthentication does not grant every SQL action
- Name and reachability
- Target name/port, listener and path.
- TLS and login
- Certificate trust/name and the selected authentication method.
- Database and action
- Target DB state, principal, object and permission.
| Observed symptom | Investigate | Not yet established |
|---|---|---|
| Server/instance not found | Name, target, protocol, listener port and path | Password validity |
| Certificate trust/name failure | Connection name, presented certificate, trust chain and client settings | Successful DB login or SELECT |
| 18456: Login failed | Contemporaneous server error/state, method, identity and DB | That the password alone caused it |
| SELECT permission error after connecting | Database context, user, object and required permission | That opening the network will fix it |
| Timeout | Whether opening a connection or executing a command, and the waiting stage | Identical wording means an identical cause |
T1: TCP succeeds, then certificate name validation fails
| Stage | T1 observation | Next check |
|---|---|---|
| TCP | Stipulated as established to the target | Verify the intended name and destination |
| TLS | Stipulated certificate-name mismatch | Match connection name with certificate identities |
| Login | No evidence the attempt reached this stage | Do not invent success or failure |
| SELECT | Not performed | Do not infer database permissions or rows |
Trust in the issuing chain and matching the connection name are separate checks. Correct certificate and connection identities through the appropriate management process. Do not substitute TrustServerCertificate or disabling encryption for a lasting diagnosis. A connection that bypasses validation does not establish the expected server identity.
Separate 18456 from a rejected action after login
18456 classifies a login failure, with possible differences in method, identity, expiry and access conditions. Do not infer a bad password from a short client message alone. An authorized investigator should correlate the server-side reason and state for the same attempt.
| Attempt | Stipulated observation | Conclusion |
|---|---|---|
| T2 | A login attempt returns 18456 | Login failed; inspect details and target |
| T3 | After authentication/CorpDocs access, SELECT on app.Documents is denied | Inspect DB principal, object and action permissions |
| T4 | Different client-B connects | Not evidence of success under client-A conditions |
Match observations and changes before deciding the fix
- Record the full failure, stage, time, source, target and method, excluding secrets.
- Identify the real listener port; distinguish named-instance discovery from connecting to that TCP port.
- For TLS, inspect trust and names; for login, method and server reason; after connection, DB context and permissions.
- After one justified change, repeat under equivalent conditions and identify which boundary changed.
- Verify the required SQL result in the intended database, rather than treating login alone as recovery.
Logs and connection strings can contain secrets, personal data and internal names. This site requests no such input or transmission; handle investigation material under the applicable organizational policy.
For RDS, add the AWS-specific checks
For RDS, correlate source placement, VPC routes/SGs/NACLs and the RDS endpoint/port. Do not apply a self-managed OS-login/listener-change procedure to ordinary RDS. AWS API permission still does not establish a database login or SELECT authorization.
Choose a next check from the evidence
Choose an option to see the result and explanation.
Check, then explain in your own words
- Classify T1 stages as observed, failed or unverified.
- Separate certificate trust/names, login rejection and SQL denial.
- Do not close an incident using another client success.
- Explain the change and expected evidence before relaxing controls.
Check your understanding: Bypassing certificate validation allows connection. Is that a lasting resolution?
No. Establish a configuration that validates the expected server.
Successful connection without validation does not establish that trust or name problems were corrected.
Sources and conditions checked
Primary references are collected here with their scope, conditions and corresponding sections. Independent expert review and live-environment validation have not been performed.
Scope and conditionsFull errors, equivalent conditions and driver/encryption/certificates; distinguish SSMS settings.
Used in this lessonFirst identify the attempt being investigated Read what an error does and does not establish T1: TCP succeeds, then certificate name validation fails Choose a next check from the evidence
Scope and conditionsCorrelate name/path, TLS, authentication and timeouts for one attempt.
Used in this lessonRead what an error does and does not establish Match observations and changes before deciding the fix Choose a next check from the evidence
- Microsoft: MSSQLSERVER 18456Checked:
Scope and conditionsMultiple login-rejection causes and correlated state/server records.
Used in this lessonRead what an error does and does not establish Separate 18456 from a rejected action after login Choose a next check from the evidence
Scope and conditionsOrdinary RDS SQL Server, version-specific support and restricted direct host access.
Used in this lessonFor RDS, add the AWS-specific checks
Scope and conditionsSeparate available status, source reachability, endpoint and port.
Used in this lessonFor RDS, add the AWS-specific checks