Cannot connect to default database

I detached my database and when I tried to reattach my database I got error 4064. how do I fix this?

more ▼

asked Jan 01, 2010 at 08:38 AM in Default

avatar image

John Manels
21 1 1 3

(comments are locked)
10|1200 characters needed characters left

1 answer: sort voted first

The problem is caused because you have detached database which was your default database.

And if you try to login from SSMS to the server by default it tries to connect you to your default database which doesn't exists currently.

If connecting from SSMS, click on the Advanced button and change the Connecto to database from "< default >" to "tempdb" or "master". Then connect to server.

if after this you will be able to attach the database, then evertyhing should be ok. if not, try to modify the default database for your login:


Instead master, you can specify any existing database on the server.

more ▼

answered Jan 01, 2010 at 09:08 AM

avatar image

Pavel Pawlowski
22.7k 10 15 26

(comments are locked)
10|1200 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

SQL Server Central

Need long-form SQL discussion? SQLserverCentral.com is the place.



asked: Jan 01, 2010 at 08:38 AM

Seen: 1775 times

Last Updated: Jan 01, 2010 at 08:38 AM

Copyright 2018 Redgate Software. Privacy Policy