This error occurs because the account cannot open the default database
Modify the default open database for this account.
If unfortunately, your SA account and Windows authentication open the same database by default, then no matter which way you log in, it's just as useless.
If you have an account that can log in, directly in the security-login name right-click the user Name property to modify the default database to master.
If you cannot log in 2 ways, modify the default database for SA by following the commands below
If unfortunately, to forget the sa password can only be logged in Windows Authentication, you happen to do not know the Windows logon name,
It's just a way to find out. What is the login name for Windows identity login?
Anyway, probably the combination is the computer name \administrator. Run the following command with CMD to modify the default open database for an account, sql2005 the following version, and change sqlcmd to isql
Sqlcmd-e-D "Master"-Q "exec sp_defaultdb n ' sa ', n ' Master'"
SQL Server 2008 Logon 4064 Error resolution