Cannot open user default database



“Cannot open user default database. Login failed. Login failed for user . (Microsoft SQL Server, Error: 4064)”


In SQL Server, a default database is assigned to each Login. This can be done from the properties of Login.

If a Login doesn’t have access ton its default database, Login will get this error when it tries to login.

Also, after a Login’s default database is set, the same error will occur if the name of the assigned database is changed or deleted.


The default database must be changed to a database that the login has access rights, or the login must be authorized on its default database.

Ekrem Önsoy
Author: Ekrem Önsoy

The original article was written in Turkish by Ekrem Önsoy and translated to English by dbtut with the consent of the author. The copyright of the article belongs to the author. The author shall not be liable in any way for any defect caused by translation.

Leave a Reply

Your email address will not be published. Required fields are marked *