# Database Discussions > MS SQL Server 7/MS SQL Server 2000 >  error 4064, cannot open user default database

## Suhen

I am experiencing some login problems.

When I connect to SQL Server 2000 using SQL Server authentication I get error message error 4064, cannot open user default database.  I can connect however if I use Windows Authentication.
The problem started when I did the ffg.
-backup sql db1
-restore db1 to another name (db2)
-drop db1
-use sp_detach
-use sp_attach to attach db2 as db1 (rename database)

When I connect in Query Analyzer via SQL Authentication I get the error, however via any other method it works fine.

Regards
Suhen

----------


## Suhen

Thanks,

They did not have a default database set.

Regards
Suhen

------------
tom goltl at 10/17/01 10:31:42 AM

Suhen,
You don&#39;t have access to your default database with the sql authenticated login.  Go into security, logins and choose your login and check to see what the default database is.  Change it to one that you have access to and things will work.

Tom


------------
Suhen at 10/17/01 2:47:51 AM

I am experiencing some login problems.

When I connect to SQL Server 2000 using SQL Server authentication I get error message error 4064, cannot open user default database.  I can connect however if I use Windows Authentication.
The problem started when I did the ffg.
-backup sql db1
-restore db1 to another name (db2)
-drop db1
-use sp_detach
-use sp_attach to attach db2 as db1 (rename database)

When I connect in Query Analyzer via SQL Authentication I get the error, however via any other method it works fine.

Regards
Suhen

----------


## elliswhitei

To resolve such error you must specify a valid, available database in the connection string. To avoid the error when the user's default database is unavailable, log on as a user who can modify logins. Then, change the user's default database to a database that is currently available for a connection.

----------


## rmiao

After 13 years?

----------

