Microsoft SQL Server error code 18456 denotes a failed login attempt which may be due to an incorrect password entry. Generally, it happens even if the username is accepted. And the error message displayed does not define the reason. However, administrators can check the error details in the event log to get a clear picture of the problem.
This error may be interpreted as a mechanism to prevent unauthorized persons from accessing the server by guessing the credentials. But, genuine users may find it hard to overcome the problem.
Probable causes of SQL server login error code 18456
SQL Server login failures can happen due to various reasons.
- The username or password entered is incorrect.
- Wrong authentication mode is enabled.
- A single username may have different passwords on different servers. So the user must be sure that he is inputting the right combination.
- Password of the user account is expired.
- User account is deleted from the server.
Resolution to SQL error code 18456
When an SQL Server is started for the first time, there is a possibility that ‘Windows authentication’ is enabled under the security option. In such situation, the server will not recognize the user and user will get the failed login 18456 error. If you want to login through ‘SQL Server Authentication’, then enable it by following the steps:
- Go to the Properties of selected server (from the right click menu).
- Now go to the Security page and under Server authentication choose the option SQL Server and Window Authentication mode.
- Now expand Security > Logins and right-click the server name, and select Properties.
- In the Login properties dialogue box, provide the password details (under SQL Authentication).
- Now go to the Status tab, and choose Enabled under Login.
- Click OK and restart the SQL server.
But if you want to use the ‘Windows authentication’ option, then it will be better if an administrator provides admin rights to the user, so that he must be able to login without any hassle.
- At first, login to SQL Server as an administrator, and go to the server where the particular user account is residing. Expand the Logins, right click on the desired account and click New Login.
- In the Login – New window, click Search.
- Now type the username of the account which you have selected in the Logins folder and then click Check Names. Click OK.
- Now back in the Login – New window, go to the Server Roles tab and check the sysadmin option.
- Now go to Securables tab, and verify the role addition.
All the above mentioned methods are used to overcome login problems. However, they cannot help when SQL database is corrupt or mdf files are inaccessible. To recover SQL data and to repair the mdf files in such cases, you need an efficient mdf recovery tool like Kernel for SQL Database Recovery. It scans, analyzes, and repair mdf or ndf file and brings back all the precious data within no time.