Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

When I try to connect to the SQL Server running on localhost using Windows Authentication in SQL Server Management Studio, I am able to connect but when I try to connect using SQL authentication, it says Login failed even though I know the user with the password exist on the DB. Here is the error log -

            ===================================

            Cannot connect to localhost.

            ===================================

            Login failed for user 'admin'. (.Net SqlClient Data Provider)

            ------------------------------
            For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&EvtSrc=MSSQLServer&EvtID=18456&LinkId=20476

            ------------------------------
            Server Name: localhost
            Error Number: 18456
            Severity: 14
            State: 1
            Line Number: 65536


            ------------------------------
            Program Location:

               at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
               at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)
               at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
               at System.Data.SqlClient.SqlInternalConnectionTds.CompleteLogin(Boolean enlistOK)
               at System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, Boolean ignoreSniOpenTimeout, Int64 timerExpire, SqlConnection owningObject)
               at System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(String host, String newPassword, Boolean redirectedUserInstance, SqlConnection owningObject, SqlConnectionString connectionOptions, Int64 timerStart)
               at System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance)
               at System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance)
               at System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection)
               at System.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(DbConnection owningConnection, DbConnectionPoolGroup poolGroup)
               at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection)
               at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)
               at System.Data.SqlClient.SqlConnection.Open()
               at Microsoft.SqlServer.Management.UI.VSIntegration.ObjectExplorer.ObjectExplorer.ValidateConnection(UIConnectionInfo ci, IServerType server)
               at Microsoft.SqlServer.Management.UI.ConnectionDlg.Connector.ConnectionThreadUser()
share|improve this question
    
I need to see the message from the actual log file to figure out what the issue is. I ask because the state is masked (there is no actual state 1) in the display but shows correctly in the log file in the server folder tree. –  JNK Jul 28 '10 at 17:43
add comment

2 Answers

Make sure that the login is created and enabled at the server level and that the login is assigned to the user in the database. Also make sure that mixed mode authentication is enabled.

share|improve this answer
add comment

Do not use localhost, use the name of the server. What about the firewall?

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.