Home > Free, Learning, SQL 2012, SQL Server, SSC, Tips'n'Tricks > Fixing: SQL Server Error 4064 …

Fixing: SQL Server Error 4064 …

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.

About these ads
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 815 other followers

%d bloggers like this: