Error in login to SQL Server
authentication, sql-server-2008
Solution
This error (`Microsoft SQL Server.Error:4064`) occurs when the database which is dropped is default for some database user.
When the user tries to login and their default database is dropped the error shows up.
Cannot open user default database. Login failed. Login failed for user ‘UserName’. (Microsoft SQL Server, Error: 4064)
The way to resolve this is given here, summarized below.
The solution to log on is:
- From the Connect to Server dialog, click Options
- Change value of Connect to database: to any valid database on the server
The permanent solution to fix the server is to run SQL like:
ALTER LOGIN [test] WITH DEFAULT_DATABASE = master
GO
Problem
When I want to connect to SQL Server 2008, I get this message: Cannot connect to server. Additional Information: Cannot open user default database. Login failed. Login fail for user 'sa'. (Microsoft SQL Server. Error:4064) How do I resolve this error?