Forum Discussion
John_S_Watson
Jul 21, 2024Copper Contributor
Login failed for user 'sp'. Reason: Password did not match that for the login provided
Please excuse my ignorance of basic SQL Server admin. Any advice much appreciated. I cannot login using passwords. For example: C:\Users\john>
C:\Users\john>sqlcmd -s jw-lat -e
1> create login sp w...
- Jul 22, 2024
I'm taking a wild guess that you're running the commands from the Command Prompt (the old-school environment that came well before PowerShell).
If that's true, then it's important to know that the command prompt processor only recognises double quotes as string delimiters, meaning the password you're attempting to log in with is actually the value:
'sp'
Which doesn't match the earlier password you set inside the sqlcmd session of:
sp
So, in other words, for your second sqlcmd where you're trying to log in using the new sp account, use the following for the password:
- sp
- "sp" (Again, the command prompt recognises double quotes as string delimiters.)
Do not use 'sp' (as the command prompt will include single quotes in the actual password value).
Cheers,
Lain
olafhelper
Jul 22, 2024Bronze Contributor
Please avoid double posts.
https://techcommunity.microsoft.com/t5/sql-server/sqlcmd-error-microsoft-odbc-driver-17-for-sql-server-login/m-p/4194887
https://techcommunity.microsoft.com/t5/sql-server/sqlcmd-error-microsoft-odbc-driver-17-for-sql-server-login/m-p/4194887