- The login does not exist or was not typed correctly
- The user forgot the password or login
- The password is incorrect
- The Windows Authentication is not in Mixed mode
- A malicious hacker reset the password
- A virus resets all the passwords
- The database was migrated, but the logins were not migrated
- The administrator modified the passwords by mistake
- The logins were damaged or the master database is damaged
Solutions
There are many different types of solutions for these scenarios. Here, we will show the most popular solutions.
Reset the Password
If you forget your password, you can ask your DBA to reset your account. The easiest way to reset the password is by using SQL Server Management Studio (SSMS). Go to security and Logins:
Select the login and you can change the password:
If you do not like to use SSMS, you can use T-SQL to create users and change the password:
Another typical problem for the error is that you are trying to log in with a SQL login, but the SQL login authentication is not enabled. In SQL Server there are two types of authentication:
- Windows Authentication that uses a Windows local or domain account to login. This option is secure and recommended.
- Mixed mode is the second option that supports Windows and SQL Authentication
If you are trying to log in with a SQL login, but the Authentication is set to Windows, you will receive the error message.
You can change the authentication mode using SSMS. Right click the SQL Server and select properties. In the properties go to Security and change the Windows Authentication to SQL Server:
This option will require to restart the SQL Server Service.
If you do not want to use SSMS, there are other options to change the SQL Server authentication.
You can use the registry to modify the authentication mode. Use the regedit to change the registry:
machineHKEY_LOCAL_MACHINESOFTWAREMicrosoftMicrosoft SQL ServerMSSQLXX.MSSQLSERVERMSSQLServer
Stellar SQL Database Toolkit
Another possible solution is to use the Stellar SQL Database Toolkit. This software contains 3 components. We will use the SQL Password Recovery to recover the password from a specific login. The other tools are used to recover the database and the backups. We will not cover them in this article.
Once downloaded, open the software and open the SQL Password Recovery:
The software will look at the master database data file (master.mdf) and get the password. As you can see, it is a straightforward process.
Conclusion
In this article, we learned the different reasons you might receive the SQL Server Error 18456. One of the reasons is that the login or the passwords are wrong. Another reason to receive this error is that the SQL Authentication is not enabled. We show how to solve this problem and learn how to retrieve the passwords using the Stellar SQL Database Toolkit.
If you have questions or suggestions regarding this article, please feel free to comment.
References
Like This Article? Read More From DZone
tutorial ,sql server error ,database ,ssms ,sql server
Opinions expressed by DZone contributors are their own.