Sqlstate 42000 sql server error 18456

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:

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:

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

Server

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.