Cannot open user default database. Login Failed (Microsoft SQL Server, Error: 4064)
I don’t know exactly what caused this, but today I tried to start SQL Server 2005 Management Studio, and got the following error: Cannot open user default database. Login Failed (Microsoft SQL Server, Error: 4064)
- When the “Connect to Server” dialog comes up, choose the Options>> button

- Next to “Connect to database:” type in “master” rather than <Default>


- Connect
It’s that simple.
If that does not completely solve the problem, then you’ll want to run SQL command from the command line, also very easy.
- Open a command prompt (Windows Key + R and type cmd)
- Type
- sqlcmd -E -d master
- ALTER LOGIN [DomainName\UserName] WITH DEFAULT_DATABASE = master
- GO
- QUIT
Refer to this blog post for more information
About this entry
You’re currently reading “Cannot open user default database. Login Failed (Microsoft SQL Server, Error: 4064),” an entry on Binary Giant
- Published:
- 12.30.08 / 12pm
- Category:
- SQL Server 2005


1 Comment
Jump to comment form | comments rss [?] | trackback uri [?]