Alex Rivera | Logout

Password mismatch while logging to sql server

Asked 2011-10-19T04:28:45.987
12

Alright, I have a classic asp application and I have a connection string to try to connect to db.

MY connection string looks as follows:

 Provider=SQLOLEDB;Data Source=MYPC\MSSQLSERVER;Initial
 Catalog=mydb;database=mydb;User Id=me;Password=123

Now when I'm accessing db though front-en I get this error:

Microsoft OLE DB Provider for SQL Server error '80040e4d'
Login failed for user 'me'. 

I looked in the sql profiler and I got this:

 Login failed for user 'me'.  Reason: Password did not match that
 for the login provided. [CLIENT: <named pipe>]
 Error: 18456, State:8. 

What I've tried:

  1. checked 100 times that my password is actually correct.
  2. Tried this: alter login me with check_policy off (Do not even know why I did this)
  3. Enable ALL possible permissions for this account in SSMS.

Update: 4. I've tried this connection string: Provider=SQLOLEDB;Data Source=MYPC\MSSQLSERVER;Initial Catalog=mydb;database=mydb; Integrated Security = SSPI

And I got this error:

Microsoft OLE DB Provider for SQL Server error '80004005' Cannot open database mydb requested by the login. The login failed.

Edit
Report

4 Answers

0

Can you log in using management studio with this user, and see the database you are trying to log into?

Perhaps there is an character encoding issue with the file that holds the connection string. Is the connection string stored as text in its own file? If so, try opening that file in Notepad++ and check what is selected in the "Encoding" menu at the top. Try changing it to UTF-8 or ANSI.

UPDATE

I just read some comments, and it sounds like you can't log in using management studio. It sounds like the Windows Authentication Mode vs SQL Server Authentication Mode is a good candidate for a root cause.

Try this:

  • Login to management studio and connect to your database using sa
  • Right-click the database server in the object explorer on the left
  • Go to the Security tab
  • Make sure you are using "SQL Server and Windows Authentication mode", not just "Windows Authentication Mode"
  • If you are currently using "Windows Authentication Mode", change it
  • Find your application user in Security > Logins
  • Right-click > Properties
  • Make sure "SQL Server authentication" is selected
  • If its not, you can try to change it, or create a new user, and make sure you select "SQL Server Authentication"
answered 2011-10-28T18:41:57.863
0

The way should be like for example...
Provider=SQLNCLI;Server=myServerName\theInstanceName;Database=myDataBase; Trusted_Connection=yes;

(Trusted_connection just in case, that's optional I believe)

answered 2011-10-28T18:56:11.683
0

First, do you understand the difference between SQL Server authentication and Windows Authentication? Based on some of the comments, I'm not sure.

You state that you checked your password 100 times; did you log into SSMS using SQL Server Authentication and verify it there? My theory is that you have a SQL Server account with the same name as your Windows account, and that you're connecting into SSMS using the Windows account, and NOT the SQL account.

answered 2011-10-28T19:18:49.753
0

Sure your Computer name is all uppercase? I found some time ago that a name in camelCase or with spaces within can cause such behavior.

If it's not, change it adding at least one letter or the change won't be succesful.

answered 2011-10-28T20:24:25.520

Your Answer