Troubleshooting Microsoft SQL Server Error 18456

Posted on by Ross Chesley | Updated:
Reading Time: 5 minutes

Login Failed for User errors with Microsoft SQL Server (MSSQL) are a fairly common issue and can be easily solved with some basic troubleshooting steps. Before we dig in, let’s take a look at the details of the Login Failed for User error to try and determine the cause.

Troubleshooting the Microsoft SQL Server error 18456 (Login Failed for User error) — Connect to Server error.
Troubleshooting Microsoft SQL Server Error 18456

Solutions to Microsoft SQL Server Error 18456 (Login Failed for User Error)

Sometimes, the error presents as “login failed for user ‘<username>’,” this information will help us as we identify the user we need to troubleshoot. From the message, we’ll know the error number as a reference to search for next steps. In this case, it is Microsoft SQL Server, Error: 18456.

Other times, we may only see “Microsoft SQL Server Error 18456” along with the severity and state number. On its own, a state number might not mean much, yet it can offer more details as to what is wrong and where to look next.

These states of the Login Failed for User error, 18456, are the most common. The descriptions and potential solutions offer a quick explanation and potential troubleshooting guide.

Troubleshooting the Microsoft SQL Server error 18456 (Login Failed for User error) — seven states and solutions for the Login User Failed error for Microsoft SQL Server.

Step 1:  Log In with Remote Desktop

The troubleshooting and solutions require you to login to the server or at least be able to make a Windows Authentication connection to MSSQL using Microsoft SQL Server Management Studio. The most common and easiest method is to connect directly to the server with a Remote Desktop Connection. If you need more information about Remote Desktop Connection, these Knowledge Base articles will help you get connected:

Step 2: Run Microsoft SQL Server Management

Once you are logged into the server, you’ll want to run Microsoft SQL Server Management Studio (SSMS). SSMS is the tool best suited to configure, manage, and administer MSSQL.

Troubleshooting the Microsoft SQL Server error 18456 (Login Failed for User error) — Microsoft SQL Server Management Studio.

When you start SSMS, you will be asked to log in to the server. By default, most MSSQL servers have Windows Authentication enabled, meaning you must log in with the Windows Administrator or the account specified as the SQL Administrator when MSSQL was installed and configured.

Troubleshooting the Microsoft SQL Server error 18456 (Login Failed for User error) — connect to Microsoft SQL Server.

In addition to Windows Authentication, MSSQL supports SQL Server Authentication. Depending on the version of MSSQL and how it was installed and configured, you may or may not have SQL Server Authentication enabled by default.

Step 3: Checking the Server Authentication Mode

Once we login to SSMS using Windows Authentication, we need to check the security settings to confirm whether MSSQL is set up to allow both Windows and SQL Authentication.

In SSMS, right-click the Server Name at the top of the Object Explorer window and choose Properties.

Next, click the Security page.

Troubleshooting the Microsoft SQL Server error 18456 (Login Failed for User error) — Microsoft SQL Server security properties.

If you find Windows Authentication is the only mode configured, this is the likely cause of Error 18456,Login Failed for User ‘<username>’.

Setting the Server authentication mode to allow SQL Server and Windows Authentication, you will be able to login to MS-SQL with a SQL user and password or a Windows user and password. After making this change, you will need to restart the SQL Server service.

Step 4: Restart the SQL Service

In SSMS, right-click the Server Name at the top of the Object Explorer window and choose Restart to apply the new authentication mode settings.  

In the above example, Windows Authentication mode was the only mode configured, and the Error 18456 (Login Failed for User error) occurred because the user ‘sa’ is a SQL user and SQL Server Authentication was not permitted.

Step 5: Checking SQL User Permissions

As we check the SQL user permissions, we need to answer the following questions:

  • Is the user allowed to log in?
  • Does the user have a valid password set up?
  • Does the user have the needed permissions for access to the desired database?

In SSMS Object Explorer, expand Security, Logins. Locate the user that was failing to log in. A x on the user indicates this user has login disabled.

Troubleshooting the Microsoft SQL Server error 18456 (Login Failed for User error) — SMSS login properties.

To allow the user to login, right-click the user and choose Properties, then click the Status page. Enabling login for the user and click OK.

Troubleshooting the Microsoft SQL Server error 18456 (Login Failed for User error) — enabling login for user.

After refreshing the list user logins, we can confirm the user no longer has a red x present. This should allow the user to log in. In this example, the SQL user ‘sa’ failed to log in because there was no permission to log in. 

Continuing with user troubleshooting, right-click the user and choose Properties, then click the General page. Here you can enter a new password and then enter the confirmation password. Click OK to save the new password. We set a new password for the user so that we are certain of the password when we attempt to log in.

Troubleshooting the Microsoft SQL Server error 18456 (Login Failed for User error) — password setup.

Step 6: Mapping the User to the Database

Our last step in troubleshooting a user is to check user mapping to verify the user has access to the desired database and to set or verify their role for the database. Right-click the user and choose Properties, then click the User Mapping page. Select the Database from the list of databases. From the database role memberships, select the desired/required memberships. Click OK.

Troubleshooting the Microsoft SQL Server error 18456 (Login Failed for User error) — map user to Microsoft SQL Server database.

In this example, we mapped the user ‘ProdX709’ to the database Production X709.2019 and granted them database role db_owner. In many cases, you only need a user to have db_datareader and db_datawriter roles to be able to read and write to the database.

Wrapping Up the Login Failed for User Error

In this troubleshooting article, we learned how to identify specifics of Error 18456 (Login Failed for User) to help us track down the root cause of the issue. Still looking for support?  Our MSSQL database solutions come with assistance from our technical support team. Find out how our high-availability database can work for you!

Get Started Today!

We pride ourselves on being The Most Helpful Humans In Hosting™!

Our Support Teams are filled with experienced Linux technicians and talented system administrators who have intimate knowledge of multiple web hosting technologies, especially those discussed in this article.

Should you have any questions regarding this information, we are always available to answer any inquiries with issues related to this article, 24 hours a day, 7 days a week 365 days a year.

If you are a Fully Managed VPS server, Cloud Dedicated, VMWare Private Cloud, Private Parent server, Managed Cloud Servers, or a Dedicated server owner and you are uncomfortable with performing any of the steps outlined, we can be reached via phone @800.580.4985, a chat or support ticket to assisting you with this process.

Avatar for Ross Chesley

About the Author: Ross Chesley

Latest Articles

Blocking IP or whitelisting IP addresses with UFW

Read Article

CentOS Linux 7 end of life migrations

Read Article

Use ChatGPT to diagnose and resolve server issues

Read Article

What is SDDC VMware?

Read Article

Best authentication practices for email senders

Read Article