The Microsoft SQL Server Error 18456 login failure has derailed more database projects than I can count. ✨ I’ve spent countless hours debugging this exact issue—from misconfigured credentials to overlooked service settings—and I’ve narrowed down the most effective fixes to the ones that actually work.
This error usually means authentication is broken at some level: wrong passwords, disabled logins, or even the SQL Server Browser service sitting idle. The good news? Most fixes take under 10 minutes once you know where to look.
I’ll walk you through the most common causes first, since they’re the easiest to resolve.
You’ll verify credentials, check service status, and confirm firewall rules—all without needing admin rights on the server. The key is methodical testing: start with the simplest fixes (like retyping the password) before diving into registry tweaks or log reviews.
For the stubborn cases, we’ll enable detailed error logging to pinpoint exactly why the login keeps failing. That’s where the real troubleshooting begins—and trust me, you’ll spot the issue faster than you think.
Why it happens
Error 18456 in Microsoft SQL Server is a login authentication failure, and it typically occurs when SQL Server cannot validate a user’s credentials or permissions. Understanding the root causes helps you pinpoint and resolve the issue efficiently.
Below are the most common reasons why this error surfaces, along with clear explanations of how they trigger the failure.
🔐 Incorrect Username or Password
This is the most straightforward cause: a typo in the username, password, or both. SQL Server’s authentication process is case-sensitive for Windows Authentication but not for SQL Authentication. If you’re using SQL Server Authentication, ensure:
- Usernames match exactly what was created in
sys.serverprincipalsorsys.databaseprincipals - Passwords are correct and haven’t been changed (especially if using SSMS or third-party tools)
- Special characters are included if they were part of the original password (e.g.,
P@ssw0rd!)
Pro Tip: 💡 Use SQL Server Management Studio (SSMS) to test credentials interactively by attempting a login before troubleshooting further.
🔒 Disabled or Locked Accounts
SQL Server can disable or lock accounts due to:
- Manual disabling via
ALTER LOGIN [user] DISABLE - Failed login attempts (if SQL Server’s
loginfailureauditlevelis configured to lock accounts) - Server policies (e.g., group policies in Active Directory for Windows Authentication)
To check account status, run:
SELECT name, isdisabled, islocked FROM sys.serverprincipals WHERE name = 'YourUsername';
If locked, unlock it with:
ALTER LOGIN [user] UNLOCK;
🏢 Authentication Mode Mismatch
SQL Server supports two authentication modes:
- Windows Authentication (integrated with Active Directory)
- SQL Server Authentication (username/password in SQL Server)
- Mixed Mode (both enabled)
Error 18456 often occurs when:
- The server is set to Windows-only, but you’re trying to log in with SQL credentials.
- The server is in SQL-only, but your connection string or client tool defaults to Windows Auth.
Verify the server’s authentication mode in:
SELECT name, authschemedesc FROM sys.databases;
Or check the SQL Server Configuration Manager under SQL Server Network Configuration > Protocols for [Instance].
🛡️ Missing or Revoked Permissions
Even with correct credentials, a user may lack permissions to connect to the server or database. Key scenarios:
- No "CONNECT" permission on the server (required for any login).
- Database-level restrictions (e.g.,
DENY CONNECTon a specific database). - Server-level roles (e.g.,
publicrole may not grant access if explicitly revoked).
Check permissions with:
-- Check server-level permissions
EXEC sphelprotect NULL, 'public';
-- Check database-level permissions
USE [YourDatabase];
EXEC sphelprotect NULL, 'public';
Grant access with:
USE [master];
GRANT CONNECT SQL TO [username];
📍 Firewall or Network Blocking
If SQL Server is running on a remote machine, network issues can silently fail logins. Common culprits:
- Firewall blocking port 1433 (default SQL Server port) or a custom port.
- Network ACLs (e.g., Azure SQL Database or cloud environments).
- VPN or proxy misconfigurations intercepting traffic.
Test connectivity with:
telnet [server_ip] 1433
If the connection fails, check:
- SQL Server Browser service (for dynamic port resolution).
- SQL Server Configuration Manager > TCP/IP properties.
⏳ Server-Side Time Sync Issues
SQL Server relies on accurate time synchronization for Kerberos authentication (Windows Auth) and some security protocols. If the server’s clock is more than 5 minutes off from the domain controller or client machine, logins may fail with 18456.
Verify time sync with:
w32tm /query /status
Sync time using:
w32tm /resync
Pro Tip: 🌡️ For cloud environments, ensure VMs or containers are configured to sync with an NTP server.
How to solve it
Encountering SQL Server error 18456 can be frustrating, but the right troubleshooting steps can quickly restore access. Below are targeted solutions mapped to the most common causes, along with preventive tips to keep your database secure and running smoothly.
🔥 Wrong Password or Credentials
If the issue stems from incorrect login details, here’s how to resolve it:
🔑 Reset the SQL Server Login Password
Use SQL Server Management Studio (SSMS) or T-SQL commands to reset the password:
- Open SSMS and connect to the server using a sysadmin account.
- Run the following T-SQL command (replace
LoginNameandNewPasswordwith the correct values):ALTER LOGIN [LoginName] WITH PASSWORD = 'NewPassword'; - Test the new credentials by attempting to log in again.
🔒 Verify Account Status and Permissions
Ensure the login isn’t disabled or locked:
- Run this query to check the login status:
SELECT name, typedesc, isdisabled FROM sys.serverprincipals WHERE name = 'LoginName'; - If disabled, re-enable it with:
ALTER LOGIN [LoginName] ENABLE; - Grant necessary permissions (e.g.,
dbownerorpublicrole) if access is still denied.
💡 Prevention Tip: Enforce strong password policies and use Windows Authentication where possible to reduce credential-related errors.
🌐 Authentication Mode Mismatch (2)
If SQL Server is configured for Windows Authentication but you’re using SQL Server authentication (or vice versa), logins will fail.
🔄 Switch Authentication Mode in SQL Server
Follow these steps to adjust the server’s authentication settings:
- Open SQL Server Configuration Manager.
- Navigate to SQL Server Services → Right-click your SQL Server instance → Properties.
- Go to the Security tab and select the appropriate authentication mode:
- Windows Authentication mode (recommended for domain environments).
- SQL Server and Windows Authentication mode (if mixed authentication is needed).
- Restart the SQL Server service for changes to take effect.
💡 Prevention Tip: Standardize authentication methods across your environment to avoid configuration conflicts.
🚫 Login Not Granted Server Access
A login might exist but lack the proper server-level permissions.
🛠️ Grant Server-Level Access
Use the following commands to assign roles:
- Connect to the server with a sysadmin account.
- Grant the login access to a server role (e.g.,
dbcreatororsecurityadmin):USE [master]; GO EXEC sp_addsrvrolemember 'LoginName', 'dbcreator'; - Verify the changes by attempting to log in again.
💡 Prevention Tip: Document and audit login permissions regularly to catch unauthorized or misconfigured access.
🔌 Firewall or Network Blocking Connections
If the error occurs remotely, network restrictions might be blocking the connection.
🔍 Check Firewall and Port Settings
Ensure SQL Server’s default port (1433) is open:
- On the SQL Server machine, open Windows Defender Firewall.
- Add an Inbound Rule to allow TCP port 1433 (or your custom port).
- Test connectivity using:
(If Telnet isn’t installed, enable it via Turn Windows features on or off.)telnet ServerName 1433
💡 Prevention Tip: Restrict firewall rules to trusted IP ranges to enhance security.
⏳ Server Overload or Service Issues
If SQL Server is unresponsive or crashing, logins may fail intermittently.
🔄 Restart SQL Server Services
Follow these steps to restart the service:
- Open Services.msc (press Win + R, type services.msc, and hit Enter).
- Locate SQL Server (MSSQLSERVER) or your custom instance name.
- Right-click → Restart.
- Wait a few minutes and attempt to log in again.
📊 Monitor Server Performance
Use SQL Server Activity Monitor or Performance Monitor to check for high CPU, memory, or disk usage that could cause timeouts.
💡 Prevention Tip: Schedule regular maintenance windows to restart services and clear temporary files.
📜 Corrupted System Databases
If the master or model database is corrupted, login failures may occur.
🛠️ Repair System Databases
Use these steps to restore or repair corrupted databases:
- Take a full backup of your databases as a precaution.
- Restore the
masterdatabase from a known good backup (requires SQL Server in single-user mode):RESTORE DATABASE [master] FROM DISK = 'BackupPath\master.bak' WITH REPLACE, RECOVERY; - Restart SQL Server and verify logins.
⚠️ Warning: This is a last-resort fix. Always back up before attempting repairs.
💡 Prevention Tip: Implement automated backups for system databases and test restore procedures regularly.
Frequently asked questions
Why does Error 18456 appear when I'm sure my password is correct?
This error often occurs due to case sensitivity issues in SQL Authentication (though not in Windows Auth) or special characters being omitted. Double-check for typos, especially if your password contains symbols like @ or #. Also verify if the login is disabled or locked using SELECT name, isdisabled, islocked FROM sys.serverprincipals. The error might also appear if the SQL Server Browser service is stopped for named instances.
How do I enable detailed error logging for Error 18456?
To capture detailed error messages, modify the SQL Server error log level. Run this command in SSMS with admin privileges: EXEC spconfigure 'show advanced options', 1; RECONFIGURE; EXEC spconfigure 'user options', 0; RECONFIGURE; This forces SQL Server to log detailed authentication failures. Check the error log via SSMS under Management > SQL Server Logs or use xpreaderrorlog in a query.
Can Error 18456 occur if my firewall is blocking SQL Server?
If port 1433 (default) or your custom port is blocked, remote connections will fail with this error. Test connectivity with telnet [server_ip] [port]. On Windows, open Windows Defender Firewall and add an inbound rule for TCP port 1433. For Azure SQL Database, ensure your client IP is in the allowed list in the Azure portal. Always verify network ACLs in cloud environments.
What's the difference between Error 18456 State 5 and State 23?
State 5 indicates invalid login credentials (wrong username/password), while State 23 means the account is disabled or locked. Use ALTER LOGIN [user] ENABLE to re-enable a disabled account. For State 23, also check if the account was locked due to failed attempts by reviewing SQL Server logs or Windows Event Viewer for security audit events. State 23 often appears after password expiration policies trigger.
How do I fix Error 18456 when using Windows Authentication?
For Windows Auth failures, verify the user exists in Active Directory and has proper permissions. Check if the SQL Server service account has permissions to access the domain controller. If using Kerberos, ensure the server's time is synchronized within 5 minutes of the domain controller. Run klist purge on the client machine to clear cached tickets, then attempt to reconnect. For double-hop scenarios, consider using constrained delegation.
- How To Restore Files From OneDrive: Step-By-Step Recovery Guide - November 30, 2026
- Why Does My Excel Keep Freezing: Quick Fixes to Speed Up Slow Spreadsheets - November 30, 2026
- Excel Pivot Charts: Dynamic Data Visualization in Minutes - November 30, 2026