0

I cannot connect to the database anymore, I'm getting:

Cannot open user default database. Login failed.

I have deleted the database during a previous session and then tried to recreate it. But the recreate failed.

Now I am stuck with this error, what can I do?

Edit: I'm using Windows Authentication

Any ideas?

Fixed:

use the command:

sqlcmd -E -d master

then type:

ALTER LOGIN [Your Windows Login] WITH DEFAULT_DATABASE=master

GO

:)

2 Answers 2

1

Fixed it!!

use the command:

sqlcmd -E -d master

then type:

ALTER LOGIN [Your Windows Login] WITH DEFAULT_DATABASE=master

GO

0

You're almost certainly going to need to restore from your last backup and apply any logs.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.