SQL SERVER – Fix : Error: 4064 – Cannot open user default database. Login failed. Login failed for user
November 4, 2008 by pinaldave
I have received following question nearly 10 times in last week though emails. Many users have received following error while connecting to the database. This error happens when database is dropped for which is default for some of the database user. When user try to login and their default database is dropped following error shows up.
Cannot open user default database. Login failed.
Login failed for user ‘UserName’. (Microsoft SQL Server, Error: 4064)
The fix for this problem is very simple.
Fix/Workaround/Solution:
First click on Option>> Button of “Connect to Server” Prompt.
Now change the connect to database to any existing database on your server like master or msdb.
Now click on connect and it will successfully log you in. Once you login in the system run following statement for your username and it should fix your problem. Make sure to replace [test] with your username and master with yourdatabase name.
ALTER LOGIN [test] WITH DEFAULT_DATABASE = master
GO
Read More:
- SQL Server 2008 18456 error and SA unable to login solution
- Solution of error converting data type varchar to datetime in SQL Server
- SQL Server 2008 login 4064 error solution
- Prompt SQL server error 15023 solution memo when modifying user mapping
- The solution of PL / SQL can’t connect to the remote server after installing Oracle locally
- SQL server error 15404 solution
- SQL server remote computer refused network connection, error: 1225, specific solution steps.
- Microsoft SQL server, additional database error: error 916 solution
- SQL 2005 remote connection error (provider: SQL network interface, error: 28 – the server does not support the requested protocol
- SQL Server 2005, unable to log in, forget sa password, 15405 error!
- SQL Server calls Database Mail to send mail error: Msg 229, Level 14, State 5, Procedure sp_send_dbmail, Line 1 EXECUTE
- JDBC connect to Sql Server to connect to the database–The TCP/IP connection to the host localhost, port 1433 has failed
- SQL Server 2008 R2 MSSqlServer failed to start. Error code 17058
- SQL Server SSPI handshake failed Error
- You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version
- 12-web security — error injection based on SQL Server — and, convert, cast
- Java 11.0.11 SQL Server connection error
- Version problem of SQL Server
- install sql server 2016 Error code 0x84B20001
- Unable to install SQL Server (setup.exe), VS Shell installation has failed with exit code 1638.