Microsoft SQL Server with error 4064

Source: Internet
Author: User

 

SQL Server-fix: Error: 4064-cannot open user default database. Login Failed. Login Failed for user

November 4, 2008 by pinaldave

I
Have received following question nearly 10 times in last week though
Emails. Many users have received following error while connecting
The database. This error happens when database is dropped for which is
Default for some of the database user. When user try to login and their
Default database is dropped following error shows up.

Cannot open user default database. Login Failed.
Login Failed for user 'username'. (Microsoft SQL Server, error: 4064)

The fix for this problem is very simple.

Fix/workaround/solution:

First click onOption>
Button of "Connect to server" prompt.

Now change the connect to database to any existing database on your server like Master or MSDB.

Now click on connect and it will successfully log you in. Once you
Login in the system run following statement for your username and it
Shocould fix your problem.Make sure to replace [test] With your username and master with yourdatabase name.

ALTER
LOGIN [test]
WITH
DEFAULT_DATABASE
=
master


Go

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.