Why Login failed for the user, getting error 18456 - Severity 14, State 38?

495    Asked by CelinaLagunas in SQL Server , Asked on Apr 24, 2021

The message that SQL Server Log File Viewer shows: Login failed for user [User] Error: 18456, Severity: 14, State 38 What it actually means: Failed to open the explicitly specified database My Question: Is there a list somewhere of all the variations of the 18456 errors (Login failed), for each combination of severity and state, with the helpful description text? I've had a Google but can't find anything other than specific combinations. what is sql server 18456?


Answered by Csaba Toth

The generic message "Login Failed for User (Microsoft SQL Server, Error: 18456)" means you entered invalid credentials when logging into SQL Server. In the below screenshot, I am logging into Microsoft SQL Server Management Studio with a user that does not have administrative permissions to connect to the server. Well, this is a database permission-related error. I am adding my solution to this question because it is very important to understand the role of DBA. So, there are my suggestions:

  • Go to Server Manager
  • Select Tools and then Computer Management
  • Check the Local Users and Groups
  • Check the admin name with the description ‘Built-in account for administering the computer/domain’
  • Now, login with that username and you can grant access to the user. To do so: Go to Security, right-click on Logins, and select New Login In the login window, you can type the user name or search it. Select the user from the list and click OK and OK again. On the same login window, click on the Server Roles, and grant access to the selected user like a sysadmin, server admin, decorator, etc; click OK. If you want to grant access to an individual database then, go to User Mapping and provide the access as per your requirement. Check the Status of the database: Permission: Grant Login: Enabled

Click OK



Your Answer

Interviews

Parent Categories