How to Bypass a Sql Server Login Failure.

How to Bypass a Sql Server Login Failure

Two Methods:
Posted by Admin

When you attempt to login to your database using SQL Server Authentication, you may get an error saying "Login failed. Login fail for user `usrLogin`. (Microsoft SQL Server, Error: 4064)". This problem may occur if the database that was set to be the default for that specific login was deleted.

Steps


Update the login to have a default database that you know exists. Here’s how to fix it. Open a command prompt and type the following:

Method1

SQL 2005

osql -S SQL01 -d master -U usrlogin -P usrpassword

ALTER LOGIN usrlogin WITH DEFAULT_DATABASE=new_default_db

Method2

SQL 2000

isql -S SQL01 -d master -U usrlogin -P usrpassword(opens query analyzer, type the next line in there) sp_defaultdb ‘usrlogin’, ‘ new_default_db’

Comments