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:
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:
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.
Or you can use the T-SQL script:
ALTER LOGIN [Blue] WITH DEFAULT_DATABASE=[TESTING2];
For more info about this error, you can check here.
Originally posted on AB Blog's:
Being part of the SQL Server community is a fantastic thing! Not only do you have the technical support of a global community, but you also have the strength the SQL Server community behind you offline as well! We know the power of the community – we’ve seen the #SQLFamily reach out to each other in the virtual world and beyond to lend a helping hand, on technical matters or not!
- #SQL Family – You have family ties to one of the biggest families in the world, the SQL Server community!
- #SQL Geek – You know you are, we know you are, so wear it with pride!
- # SQL Server 2012 Fan – Enough said.
- #Big Data Enthusiast – The bigger, the better! If you agree, you are a big data enthusiast!
- #DBA Superhero
View original 1 more word