Forum Discussion

John_S_Watson's avatar
John_S_Watson
Copper Contributor
Jul 21, 2024
Solved

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...
  • LainRobertson's avatar
    Jul 22, 2024

    John_S_Watson 

     

    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

Resources