Jump to content

Archived

This topic is now archived and is closed to further replies.

TLawrence

[SOLVED] Cannot open user default database. Using master database instead.

Recommended Posts

I have a client who just recently started receiving the following error.

 

"Warning: mssql_connect() [function.mssql-connect.html]: message: Cannot open user default database. Using master database instead. (severity 11) in filename on line 2"

 

According to them, nothing has changed regarding their database, so what would typically cause this error to occur?  This is the first project I've done using MSSQL, so I'm not that familiar with the database software and I've never seen this error before.

Share this post


Link to post
Share on other sites

it means the default database for the user you are connecting with doesn't exist or you don't have permission to access it

Share this post


Link to post
Share on other sites

So more than likely something DID change on the client's side regarding the database, even though they're telling me nothing changed?

 

Can you explain the difference between a default database and master database?  What are their purposes and when/how are they created?  Wouldn't their IT person know if a default database no longer existed (db dropped)?  Or if permissions changed? 

Share this post


Link to post
Share on other sites

the master database is just the general system database that mssql needs.

 

ask the IT team what your default DB is set to

 

also, after you get the warning, can you select your DB, and query your data ok? if so, just put an @ in front of the function and ignore the warning. while it is good to fix it, it won't hurt to have a bad default db

Share this post


Link to post
Share on other sites

You bring up a good point.  If the warning isn't harming anything, than just ignore it.  I know that's not good practice, but it's a good temporary fix until we figure out the real problem. 

 

Thanks for the help!

 

 

Share this post


Link to post
Share on other sites

do you have the MSSQL Management Studio? you should be able to connect with that and look up your default db.

 

once in the management studo, and connected to your server, expand the 'Security' section, then the 'Logins' section. right click on your account and select 'Properties'. the default db will be on the main page that comes up.

Share this post


Link to post
Share on other sites

I don't have access to the database in question, but I can look at my own local databases...I see what you're talking about. 

 

Thanks for the tip, this definitely helps!

Share this post


Link to post
Share on other sites

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.