• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 4007
  • Last Modified:

SQL 2005 cannot open user default database. Login Failed Error:4064

Just installed SQL 2005...I am trying to setup a user so that they have a default database that I will use in the connection string in my .net ASP code...I have created the login, gave them access to the db, set the db as their default db...Then when I try to connect to SQL 2005 using their login, I get 'Cannot connect to localhost. Cannot open user default database.  Login failed. Login failed for user 'maguser' (Error:4064).  I have seen the emails to alter user and set it to master...but I want it to default to my other DB...so that my connection string will work when I specify the db in it...
0
cenetadmin
Asked:
cenetadmin
1 Solution
 
Faiga DiegelSr Database EngineerCommented:
hae you tried enrolling that user to a specifi database?

USE [DatabaseName]
GO

CREATE USER [maguser]
FOR LOGIN [maguser]
WITH DEFAULT_SCHEMA = [dbo] /*or whatever default schema you have setup*/
GO
0
 
NazoUKCommented:
Have you set the logon mode of sqlserver to allow sql server authentication? The default is windows authentication only.

In SQL Server Management Studio right click your server, choose properties then in the security tab change logons to allow windows and sql server authentication
0
 
cenetadminAuthor Commented:
I have the login authentication setup correctly for my SQL 2005...The issue seems to be that I have Attached the db's and the users already exist in the db's...
0
 
maradamCommented:
You don't need to set default database for login if you also set it in connection string.
0

Featured Post

[Webinar] Improve your customer journey

A positive customer journey is important in attracting and retaining business. To improve this experience, you can use Google Maps APIs to increase checkout conversions, boost user engagement, and optimize order fulfillment. Learn how in this webinar presented by Dito.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now