ProgrammerAH

Programmer Guide, Tips and Tutorial

Skip to content

Solution to SQL Server Error: 4064

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

This entry was posted in How to Fix and tagged database, login, microsoft, server, SQL Server, user on 2020-11-23 by Robins.

Post navigation

← Python 3.4 compiler prompt error: unexpected indent DB2 encountered the problem of sqlcode = 911 lock table when updating record update →

Recent Posts

  • MAFIA: 1- OpenFlow statistics (Counters, Timestamps)(mafia-sdn/p4demos/demos/1-openflow/1.1-statistics/p4src/of.p4)
  • LDSC: Could not open Corces_ATAC_1000Gv3_ldscores/Corces_ATAC.1.1.l2.ldscore[./gz/bz2]
  • Gradle Package Project Lombok Not Working: No serializer found for class com.qbb.User and no properties discovered to create BeanSerializer……
  • [Solved] PCH Warning: header stop not at file scope
  • pymysql Error: File “/usr/local/lib/python2.7/site-packages/PyMySQL-1.0.2-py2.7.egg/pymysql/connections.py”, line 167 SyntaxError: invalid syntax
Proudly powered by WordPress