Wednesday, December 24, 2008

Sql Server Cannot open user default database. Login failed

This may help a few people. I was trying to connect to SQL Server 2008 from my VS 2008 and suddenly it could not list any databases from my server. I had Enterprise edition. I believe the same problems can occur in any versions of SQL Server be it Express, Standard or WorkGroup editions.

The exact error message was Cannot open user default databaseLogin failedLogin failed for user '' , Error Number 4064.

After a lot of google search which could not actually point to my actual problems, I found it myself.

 We basically need to specify the default database for the user login. If not, then we won't be able to login. 

  But one problem here is that we need some other account either "sa" or some other admin account to change this setting. This setting is found at Sql Management Studio --> Security --> Logins --> Double click on the user name..

 Hope someone finds this useful.

No comments: