“Cannot open user default database. Login failed.” after installing SQL Server Management Studio Express

This may not be answering your question specifically, but it may help others with similar issue caused by different problem

In my case the problem was my user is defaulted to a database which is not accessible for any reason (can be renamed, removed, corrupted or …)
To solve the issue just follow the following instruction

  1. Try to login again on the login page there is other tabs select
    “Connection Properties”.

  2. under the tab locate “Connect to database” and select an existing database you have access to like tempdb or master

  3. Once you are connected to the SQL Server Instance execute the below TSQL to assign the login a new default database.

    Use master
    GO
    
    ALTER LOGIN [yourloginname] WITH DEFAULT_DATABASE = TempDB
    GO
    

Alternatively once you connected change your default database name to master via UI

Article taken from :
http://www.mytechmantra.com/LearnSQLServer/Fix-cannot-open-user-default-database-Login-failed-Login-failed-for-user-SQL-Server-Error/

Leave a Comment