locked
Cannot open user default database RRS feed

  • Question

  • Hi,

    one of our users was getting the "Cannot open user default database" error message when trying to connect from one server to another.

    I logged onto the target server and set up the login and database users required.

    I also set the default database for the login to MASTER.

    However the problem still continued.

    I noticed that when I started a new Query in the management studio it always opened up a different database to the Master database, lets call it  MyDB.

    Eventually I got the login to work by creating a user for it in the MyDB database.

    I don't understand why it is not using the default database I specified for the Login.

    Also where is the setting that has made the MyDB database be selected for every new sql query in management studio.

     


    Sean
    Tuesday, June 28, 2011 1:59 PM

Answers

  • Hi,
     
    Please run following T-SQL script and locate your login. What is the database name?
    select
    [name], dbname from syslogins
    • Marked as answer by Sean2000 Tuesday, June 28, 2011 3:24 PM
    Tuesday, June 28, 2011 2:21 PM

All replies

  • Hi,
     
    Please run following T-SQL script and locate your login. What is the database name?
    select
    [name], dbname from syslogins
    • Marked as answer by Sean2000 Tuesday, June 28, 2011 3:24 PM
    Tuesday, June 28, 2011 2:21 PM
  • Hi,

    I looked in syslogins originally and it looked ok, my login was set up with a default of the master database. But thanks for prompting me, I've just looked again and noticed that we also have an entry of "MY-Domain\Domain Users" , which is pointing at a default database of MyDB. As all windows logins are in this group this must be where they are picking this default database value from, instead of the login I created for the group.

    thanks

     

     


    Sean
    Tuesday, June 28, 2011 2:55 PM