Fixing: SQL Server Error 4064 …

, 2013-02-11

An error that is known how to solve it, I was the victim today with it and when I started the SSMS, I saw that error. I’m telling you here how to fix it as fast info and references from MS.

This error usually comes when your DB no longer exists or it is in suspect mode or has been detached or offline etc, and you will have the pop-up message with error description and the number 4064:

Error4064

Ok, as you can see the user Blue cannot connect in the default database and the login failed!

Fixing this error is really easy, so you can try again to login with that user but first before to Connect, you must go to the Options that is in right corner below and you will be asked for the Connection Properties on the second tab of the login dialog box and you must enter the master database in the drop-down box, see the fig below and hit Connect:

OptionConn

Now you will be able to connect in your SQL Server. So what’s next!? As I said, some of the reason why it happened are described above, so now you can check for the correct DB that must be as default DB of that user. After that to be sure for the next connection you need to change the default DB via T-SQL or GUI:

GUI: Open the SSMS  on the right, you have object Explorer, go to Security > Logins > Find your login and right click > Properties. You will have the dialog box like shown in the fig below.

Testing

Or you can use the T-SQL script:

USE [master]

GO

ALTER LOGIN [Blue] WITH DEFAULT_DATABASE=[TESTING2];

GO

For more info about this error, you can check here.

Rate

Share

Share

Rate

Related content

Database Mirroring FAQ: Can a 2008 SQL instance be used as the witness for a 2005 database mirroring setup?

Question: Can a 2008 SQL instance be used as the witness for a 2005 database mirroring setup? This question was sent to me via email. My reply follows. Can a 2008 SQL instance be used as the witness for a 2005 database mirroring setup? Databases to be mirrored are currently running on 2005 SQL instances but will be upgraded to 2008 SQL in the near future.

2009-02-23

1,567 reads

Networking - Part 4

You may want to read Part 1 , Part 2 , and Part 3 before continuing. This time around I'd like to talk about social networking. We'll start with social networking. Facebook, MySpace, and Twitter are all good examples of using technology to let...

2009-02-17

1,530 reads

Speaking at Community Events - More Thoughts

Last week I posted Speaking at Community Events - Time to Raise the Bar?, a first cut at talking about to what degree we should require experience for speakers at events like SQLSaturday as well as when it might be appropriate to add additional focus/limitations on the presentations that are accepted. I've got a few more thoughts on the topic this week, and I look forward to your comments.

2009-02-13

360 reads