The Microsoft SQL Server Login Failed error 18456 indicates that the server successfully received the login request but rejected it due to invalid credentials or insufficient permissions. This article helps you identify and resolve the specific cause of this error for your Microsoft SQL Server database.
Before you begin
You will need:
Access to the Microsoft SQL Server instance (via SQL Server Management Studio or a similar management tool).
The specific username and password you are attempting to use for the connection.
Administrative access to the server or the database instance to verify user permissions.
Check the login credentials
The most common cause of error 18456 is an incorrect username or password.
Verify the username. Ensure there are no extra spaces at the beginning or end of the username.
Re-type the password manually to ensure no typos were made during the configuration of your application or connection string.
If using Windows Authentication, ensure the Windows account has been granted permission to access the SQL instance.
Verify the login method
Microsoft SQL Server supports two primary authentication modes: Windows Authentication and Mixed Mode (SQL Server Authentication).
Determine which method your application is attempting to use.
If your application uses a SQL login (e.g.,
saor a custom created user), ensure the SQL Server instance is configured for Mixed Mode.If the server is in Windows Authentication Mode only, SQL logins will fail with error 18456.
Verify user permissions and status
The account may exist but may be disabled or lack the necessary permissions to log in.
Open SQL Server Management Studio (SSMS).
Connect to the instance using an account with administrative privileges.
Navigate to Security > Logins.
Locate the specific user account you are trying to use.
Right-click the user and select Properties.
Under Status, ensure that Login is set to Enabled.
Under Permissions, ensure the user has the necessary rights to access the specific database required by your application.
Check the connection string
An incorrect connection string can cause the server to attempt the wrong authentication method.
Open your application's configuration file or connection settings.
Verify the
User IDandPasswordfields.If using a SQL login, ensure the connection string does not explicitly request Windows Authentication if you intend to use a SQL account.
Confirm the database name
If the user is valid but does not have permission to access the specific database mentioned in the connection string, the login may fail.
In the user's properties in SSMS, go to the User Mapping page.
Ensure the specific database is checked and that the user has the appropriate role (such as
db_datareaderordb_datawriter).
Contact Hostek support
If you have verified the credentials, confirmed the server is in the correct authentication mode, and confirmed the user is enabled but still receive error 18456, please contact Hostek support.
Provide the following information to help us investigate:
The specific error message and code (e.g., Error 18456).
The username you are attempting to use.
The method you are using to connect (e.g., an application, a script, or SQL Server Management Studio).
A copy of the connection string (ensure you remove your actual password before sharing).
