SQL Server 2008 login 4064 error solution

This error is caused by the account being unable to open the default database
Change the default open database for this account.
If, unfortunately, your SA account and Windows authentication are both open to the same database by default, logging in either way is equally useless
If you have an account that you can log in to, just right click on the security – login username property and change the default database to master.
If you cannot log in either way, modify the default database for the SA by following the command below
If you’re unlucky enough to forget your SA password and you can only log in with Windows authentication, and you don’t happen to know the Windows login name,
Ga can only try to find out what the Windows identity login name is
The combination is probably the computer name \Administrator. Run the following command with CMD to change the default open database for an account, sql2005 version below, and change SQLCMD to ISQL
sqlcmd -E -d”master” -Q”exec sp_defaultdb N’sa’, N’master'”

Reproduced in: https://www.cnblogs.com/Jerseyblog/p/4971227.html

Read More: