Password mismatch while logging to sql server
Solution 1
In my case, I had a connection string working with SQL Server 2008 R2, but after updating to SQL Server 2014, I received the mentioned error. Here is what my original connection string was like:
server=.\SQLEXPRESS;database=mydb;User Id=me;Password=123
Here is the update connection string that works with 2014:
Integrated Security=SSPI;Data Source=.\SQLEXPRESS;Database=mydb;User Id=me;Password=123
Solution 2
Change your connection string to:
Provider=SQLNCLI10;SERVER=MYPC\MSSQLSERVER;DataTypeCompatibility=80;Database=mydb;User Id=me;Password=123
It worked for me. Try to use IP if server is remote or (local) if it is on the same machine.
Hope this helps.
user194076
Updated on July 09, 2022Comments
-
user194076 almost 2 years
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:
- checked 100 times that my password is actually correct.
- Tried this:
alter login me with check_policy off
(Do not even know why I did this) - 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.
-
user194076 over 12 yearsNow it says the following: Microsoft OLE DB Provider for ODBC Drivers error '80004005' [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
-
Jinesh Jain over 12 yearsProvider=SQLOLEDB;Data Source=MYPC\MSSQLSERVER;Initial Catalog=mydb;database=mydb;User Id=me;Password=123 please remove database=mydb; from your string because initialcatalog and database is same thing
-
user194076 over 12 yearsThe same thing. Does not help :(
-
Jinesh Jain over 12 yearscan you able to login to SQL server management by same credential mentioned as above ? because this same connection string is working with my credential so in connection string there is no Problem.
-
user194076 over 12 yearsYes I can connect to SSMS both with windows and user auth.
-
Jinesh Jain over 12 yearsCan you adjust this as a window authentication for just testing and can see is this works or not
-
user194076 over 12 yearsI did. I tried Integrated Security = SSPI, and it still does not work. the same error. I wrote about this in my post.
-
SteveCav over 12 yearsA driver issue? Can you connect from a different machine?
-
Carth over 12 years@user194076 - Have you tried Gab's answer here? I've encountered login failures like this when the Provider in the connection string was set incorrectly.
-
blizz about 8 yearsAdding Integrated Security=SSPI; to my connection string fixed it for me using SQL 2014 as well
-
Chris Nevill about 7 yearsDoesn't adding Integrated Security just cause it to use Windows Authentication instead of the provided credentials? stackoverflow.com/questions/1229691/…
-
user8128167 about 7 yearsThat appears to be the case except for CE: connectionstrings.com/sql-server-2012