SOLVED

SQL Server fails login with password having semicolon

%3CLINGO-SUB%20id%3D%22lingo-sub-3488745%22%20slang%3D%22en-US%22%3ESQL%20Server%20fails%20login%20with%20password%20having%20semicolon%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3488745%22%20slang%3D%22en-US%22%3E%3CP%3EHi%2C%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIt%20looks%20like%20that%20SQL%20Server%20is%20not%20able%20to%20login%20when%20the%20password%20used%20contains%20a%20semicolon.%20I%20was%20able%20to%20create%2Fupdate%20a%20user%20to%20the%20server%20defining%20the%20password%20with%20semicolon%20in%20it%2C%20however%20I%20am%20unable%20to%20login%20using%20such%20user%2C%20the%20system%20responds%20%22Login%20failed%20for%20user%20XXXX.%26nbsp%3B%20Error%2018456%22.%26nbsp%3B%20It%20is%20odd%20because%20I%20am%20able%20to%20set%20such%20password%20to%20the%20user.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ERecently%20I%20have%20been%20working%20on%20a%20development%20to%20properly%20process%20semicolon%20as%20part%20of%20the%20password%20in%20the%20connection%20strings%20but%20now%20I%20found%20this%20issue.%20I%20wonder%20if%20I%20need%20to%20change%20some%20configuration%20in%20the%20server%20in%20order%20to%20resolve%20this%20error%2C%20could%20you%20help%20please%3F%26nbsp%3B%20Maybe%20it%20is%20associated%20with%20the%20password%20policy%3F%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThanks%20in%20advance%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3490455%22%20slang%3D%22en-US%22%3ERe%3A%20SQL%20Server%20fails%20login%20with%20password%20having%20semicolon%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3490455%22%20slang%3D%22en-US%22%3E%3CP%3EHi%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1419320%22%20target%3D%22_blank%22%3E%40ACarrera1971%3C%2FA%3E%20--%20What%20is%20the%20state%20code%20associated%20with%20the%20Error%2018456%3F%26nbsp%3B%20Also%2C%20can%20you%20run%20the%20query%20below%20to%20ensure%20that%20mixed-mode%20authentication%20is%20enabled%20on%20the%20instance%3F%26nbsp%3B%20Take%20care.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-sql%22%3E%3CCODE%3ESELECT%20CASE%20%0AWHEN%20SERVERPROPERTY('isIntegratedSecurityOnly')%20%3D%201%20THEN%20'Windows-only%20authentication'%0AWHEN%20SERVERPROPERTY('isIntegratedSecurityOnly')%20%3D%200%20THEN%20'Mixed-mode%20authentication'%0AEND%20AS%20AuthMode%3C%2FCODE%3E%3C%2FPRE%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3490870%22%20slang%3D%22en-US%22%3ERe%3A%20SQL%20Server%20fails%20login%20with%20password%20having%20semicolon%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3490870%22%20slang%3D%22en-US%22%3E%3CP%3EHi%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1419320%22%20target%3D%22_blank%22%3E%40ACarrera1971%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIt%20can%20help%20if%20you%20provide%20us%20with%20the%20queries%20you%20run%2C%20because%20the%20mind%20reading%20ability%20of%20some%20of%20us%20does%20not%20work%20well.%20When%20you%20have%20an%20issue%2C%20then%20first%20of%20all%20you%20should%20describe%20what%20you%20did%20and%20as%20possible%20provide%20the%20tool%20to%20reproduce%20the%20case.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIn%20general%20%3CSTRONG%3EBY%20DEFAULT%3C%2FSTRONG%3E%20there%20is%20no%20issue%20in%20using%26nbsp%3Bsemicolon%20in%20password.%20You%20can%20use%20any%20UNICODE%20character%20as%20well%20and%20not%20just%20English%20-%20Note%20that%20%3CFONT%20color%3D%22%23DF0000%22%3E%3CSTRONG%3E%22can%22%20DONT%20NOT%20mean%20%22should%22!%3C%2FSTRONG%3E%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-sql%22%3E%3CCODE%3EUSE%20master%0AGO%0ACREATE%20LOGIN%20%5BRonen%D7%A8%D7%95%D7%A0%D7%9FWithsemicolon%3B%5D%20WITH%20PASSWORD%20%3D%20'%5BPassWithsemicolon%3BAndHebrew%D7%A2%D7%91%D7%A8%D7%99%D7%AA%5D'%3B%0AGO%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CFONT%20color%3D%22%23000000%22%3EThe%20above%20code%20uses%26nbsp%3Bsemicolon%20and%20Hebrew%26nbsp%3Bcharacters%26nbsp%3Band%20it%20run%20without%20any%20issue.%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CFONT%20color%3D%22%23000000%22%3ENote!%20It%20is%20highly%20recommend%26nbsp%3BNOT%20to%20use%20special%20characters%20in%20the%20LOGIN%20name%2C%20but%20for%20password%20it%20is%20a%20good%20idea%20to%20do%20so%2C%20with%20that%20said%20using%20non-English%20characters%20is%20not%20recommended%20if%20you%20cannot%20confirm%20that%20you%20will%20have%20option%20to%20use%20such%20chars%20anyway%20and%20everywhere.%26nbsp%3B%3C%2FFONT%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3490939%22%20slang%3D%22en-US%22%3ERe%3A%20SQL%20Server%20fails%20login%20with%20password%20having%20semicolon%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3490939%22%20slang%3D%22en-US%22%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CBLOCKQUOTE%3Ehaving%20semicolon%3CHR%20%2F%3E%3C%2FBLOCKQUOTE%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1419320%22%20target%3D%22_blank%22%3E%40ACarrera1971%3C%2FA%3E%26nbsp%3B%2C%20if%20you%20are%20using%20ODBC%20then%20it's%20a%20known%20issue.%20The%20semicolon%20is%20the%20parameter%20separator%20and%20if%20its%20used%20in%20user%20name%20or%20passwrod%20it%20causes%20a%20login%20error.%3C%2FP%3E%3CP%3EThere%20are%20some%20more%20characters%2C%20see%3C%2FP%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fcommunity.microstrategy.com%2Fs%2Farticle%2FSpecial-character-restrictions-of-username-and-password-in-ODBC-connection-for-Diamond-and-Platinum-gateways-new%3Flanguage%3Den_US%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3EKB484846%3A%20Special%20character%20restrictions%20of%20username%20and%20password%20in%20ODBC%20connection%20for%20Diamond%20and%20Platinum%20gateways%20(microstrategy.com)%3C%2FA%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EOlaf%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3491391%22%20slang%3D%22en-US%22%3ERe%3A%20SQL%20Server%20fails%20login%20with%20password%20having%20semicolon%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3491391%22%20slang%3D%22en-US%22%3E%3CP%3EHi%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F305348%22%20target%3D%22_blank%22%3E%40bake13%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThanks%20for%20your%20answer.%20The%20authentication%20mode%20of%20the%20server%20I%20was%20testing%20on%20is%20%22Mixed%20authentication%20mode%22%2C%20in%20fact%20I%20am%20trying%20to%20login%20using%20a%20SQL%20Server%20user%2C%20do%20you%20think%20it%20plays%20a%20role%20with%20this%20issue%3F%26nbsp%3B%3C%2FP%3E%3CP%3EReally%20I%20am%20creating%20the%20login%20and%20updating%20the%20password%20using%20the%20SQL%20Server%20Management%20Studio.%26nbsp%3B%3C%2FP%3E%3CP%3EI%20have%20been%20also%20trying%20to%20login%20using%20the%20SQL%20Management%20Studio%20and%20the%20error%20code%26nbsp%3B%3CSPAN%3E18456%20is%20returned%20in%20the%20popup%2C%20I%20assumed%20it%20was%20the%20regular%20incorrect%20password.%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3491430%22%20slang%3D%22en-US%22%3ERe%3A%20SQL%20Server%20fails%20login%20with%20password%20having%20semicolon%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3491430%22%20slang%3D%22en-US%22%3EThanks%20for%20your%20answer%2C%3CBR%20%2F%3EReally%20I%20was%20not%20using%20any%20query%2C%20I%20was%20using%20the%20SQL%20Management%20Studio%20for%20carrying%20out%20the%20update%2Fcreate%20of%20the%20login%20with%20semicolon%20in%20the%20password%20and%20also%20to%20login%20(although%20I%20tested%20using%20the%20ADO%20after%20having%20resolved%20the%20issue%20with%20semicolon%20in%20he%20connection%20string).%3CBR%20%2F%3EI%20fully%20agree%20with%20you%20that%20having%20semicolon%20in%20the%20password%20should%20not%20be%20a%20problem%20at%20all%20and%20this%20is%20the%20reason%20I%20wonder%20if%20the%20problem%20I%20am%20experiencing%20is%20associated%20with%20a%20special%20kind%20of%20configuration%20in%20the%20server.%3CBR%20%2F%3EI%20will%20try%20using%20the%20direct%20SQL%20sentences%20to%20create%20the%20login.%20Good%20to%20know%20you%20did%20not%20find%20any%20issue%20with%20such%20password.%3CBR%20%2F%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3491509%22%20slang%3D%22en-US%22%3ERe%3A%20SQL%20Server%20fails%20login%20with%20password%20having%20semicolon%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3491509%22%20slang%3D%22en-US%22%3EHi%20Olaf%2C%3CBR%20%2F%3EThanks%20for%20your%20reply%2C%20yes%20I%20used%20ODBC%20and%20ADO%20connections%20strings%20and%2C%20I%20think%2C%20I%20resolved%20the%20issues%20at%20this%20point.%20My%20problem%20is%20associated%20with%20the%20server%20that%20appears%20to%20deny%20passwords%20in%20this%20way.%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3491657%22%20slang%3D%22en-US%22%3ERe%3A%20SQL%20Server%20fails%20login%20with%20password%20having%20semicolon%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3491657%22%20slang%3D%22en-US%22%3EThanks%20everybody%20for%20your%20answers%20to%20this%20simple%20question.%3CBR%20%2F%3EI%20can%20confirm%20that%20semicolon%20in%20the%20password%20actually%20worked%20as%20expected%2C%20I%20have%20been%20able%20to%20succeed%20on%20this%20after%20using%20direct%20scripts%20to%20set%20the%20pasword%20with%20semicolon.%3CBR%20%2F%3EI%20am%20now%20suspecting%20that%20the%20use%20of%20the%20SQL%20Server%20Management%20made%20me%20to%20set%20a%20wrong%20password%20in%20every%20attempt%20provoking%20the%20error.%3CBR%20%2F%3EThanks%20again%20to%20everyone%20for%20your%20useful%20suggestions%20and%20comments.%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3499460%22%20slang%3D%22en-US%22%3ERe%3A%20SQL%20Server%20fails%20login%20with%20password%20having%20semicolon%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3499460%22%20slang%3D%22en-US%22%3E%3CP%3EHi%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1419320%22%20target%3D%22_blank%22%3E%40ACarrera1971%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThere%20is%20no%20issue%20using%20SSMS%20with%20such%20password!%20Remember%20my%20sample%20above%3F%3C%2FP%3E%0A%3CP%3EHere%20I%20can%20use%20the%20SSMS%20GUI%20to%20connect%20the%20server%20using%20this%20complex%20LOGIN%20and%20password%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Ronen_Ariely_0-1655118015687.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Ronen_Ariely_0-1655118015687.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Ronen_Ariely_0-1655118015687.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Ronen_Ariely_0-1655118015687.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F379759i73851E6BBF61D2D3%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22Ronen_Ariely_0-1655118015687.png%22%20alt%3D%22Ronen_Ariely_0-1655118015687.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3EYour%20conclusion%20is%20wrong%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ENote!%20When%20using%20SSMS%20you%26nbsp%3Bdo%20not%20add%20quotation%20marks%20or%20parentheses%20to%20the%20password%20or%20username.%20The%20software%20already%20adds%20these%20automatically%20when%20sending%20the%20query%20to%20the%20server.%20so%20if%20you%20use%20%3CFONT%20color%3D%22%23008000%22%3E%5Bpassword%5D%3C%2FFONT%3E%26nbsp%3Binstead%20of%20%3CFONT%20color%3D%22%23008000%22%3Epassword%20%3C%2FFONT%3Ethen%20you%20will%20get%20an%20error%20message.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3500471%22%20slang%3D%22en-US%22%3ERe%3A%20SQL%20Server%20fails%20login%20with%20password%20having%20semicolon%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3500471%22%20slang%3D%22en-US%22%3EHi%20Ronen%2C%3CBR%20%2F%3EI%20did%20not%20explain%20myself%2C%20the%20fact%20that%20I%20use%20SSMS%20made%20me%20go%20wrong%20because%20I%20did%20not%20check%20properly%20the%20password%20(after%20several%20tries%20in%20fact)%20so%20I%20wrongly%20concluded%20the%20fact%20that%20semicolon%20was%20not%20allowed%20as%20password.%20SSMS%20is%20ok%20but%20the%20fact%20it%20did%20not%20display%20the%20password%20(as%20it%20must%20do).%3CBR%20%2F%3EI%20can%20confirm%20that%20SSMS%20worked%20well%20at%20this%20point%2C%20it%20was%20entirely%20my%20fault%2C%20thanks%20for%20your%20time.%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3527945%22%20slang%3D%22en-US%22%3ERe%3A%20SQL%20Server%20fails%20login%20with%20password%20having%20semicolon%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3527945%22%20slang%3D%22en-US%22%3EYou%20are%20most%20welcome%20and%20I%20am%20glad%20to%20hear%20that%20all%20was%20solved%20%3A)%3C%2Fimg%3E%3C%2FLINGO-BODY%3E
Occasional Contributor

Hi, 

 

It looks like that SQL Server is not able to login when the password used contains a semicolon. I was able to create/update a user to the server defining the password with semicolon in it, however I am unable to login using such user, the system responds "Login failed for user XXXX.  Error 18456".  It is odd because I am able to set such password to the user. 

 

Recently I have been working on a development to properly process semicolon as part of the password in the connection strings but now I found this issue. I wonder if I need to change some configuration in the server in order to resolve this error, could you help please?  Maybe it is associated with the password policy? 

 

Thanks in advance

 

10 Replies

Hi@ACarrera1971 -- What is the state code associated with the Error 18456?  Also, can you run the query below to ensure that mixed-mode authentication is enabled on the instance?  Take care.

 

SELECT CASE 
WHEN SERVERPROPERTY('isIntegratedSecurityOnly') = 1 THEN 'Windows-only authentication'
WHEN SERVERPROPERTY('isIntegratedSecurityOnly') = 0 THEN 'Mixed-mode authentication'
END AS AuthMode
best response confirmed by ACarrera1971 (Occasional Contributor)
Solution

Hi @ACarrera1971 

It can help if you provide us with the queries you run, because the mind reading ability of some of us does not work well. When you have an issue, then first of all you should describe what you did and as possible provide the tool to reproduce the case.

 

In general BY DEFAULT there is no issue in using semicolon in password. You can use any UNICODE character as well and not just English - Note that "can" DONT NOT mean "should"!

 

 

USE master
GO
CREATE LOGIN [RonenרונןWithsemicolon;] WITH PASSWORD = '[PassWithsemicolon;AndHebrewעברית]';
GO

 

The above code uses semicolon and Hebrew characters and it run without any issue.

 

Note! It is highly recommend NOT to use special characters in the LOGIN name, but for password it is a good idea to do so, with that said using non-English characters is not recommended if you cannot confirm that you will have option to use such chars anyway and everywhere. 

 

having semicolon

@ACarrera1971 , if you are using ODBC then it's a known issue. The semicolon is the parameter separator and if its used in user name or passwrod it causes a login error.

There are some more characters, see

KB484846: Special character restrictions of username and password in ODBC connection for Diamond and...

 

Olaf

Hi @bake13 

Thanks for your answer. The authentication mode of the server I was testing on is "Mixed authentication mode", in fact I am trying to login using a SQL Server user, do you think it plays a role with this issue? 

Really I am creating the login and updating the password using the SQL Server Management Studio. 

I have been also trying to login using the SQL Management Studio and the error code 18456 is returned in the popup, I assumed it was the regular incorrect password. 

 

Thanks for your answer,
Really I was not using any query, I was using the SQL Management Studio for carrying out the update/create of the login with semicolon in the password and also to login (although I tested using the ADO after having resolved the issue with semicolon in he connection string).
I fully agree with you that having semicolon in the password should not be a problem at all and this is the reason I wonder if the problem I am experiencing is associated with a special kind of configuration in the server.
I will try using the direct SQL sentences to create the login. Good to know you did not find any issue with such password.
Hi Olaf,
Thanks for your reply, yes I used ODBC and ADO connections strings and, I think, I resolved the issues at this point. My problem is associated with the server that appears to deny passwords in this way.
Thanks everybody for your answers to this simple question.
I can confirm that semicolon in the password actually worked as expected, I have been able to succeed on this after using direct scripts to set the pasword with semicolon.
I am now suspecting that the use of the SQL Server Management made me to set a wrong password in every attempt provoking the error.
Thanks again to everyone for your useful suggestions and comments.

Hi @ACarrera1971 

 

There is no issue using SSMS with such password! Remember my sample above?

Here I can use the SSMS GUI to connect the server using this complex LOGIN and password

Ronen_Ariely_0-1655118015687.png

Your conclusion is wrong

 

Note! When using SSMS you do not add quotation marks or parentheses to the password or username. The software already adds these automatically when sending the query to the server. so if you use [password] instead of password then you will get an error message.

Hi Ronen,
I did not explain myself, the fact that I use SSMS made me go wrong because I did not check properly the password (after several tries in fact) so I wrongly concluded the fact that semicolon was not allowed as password. SSMS is ok but the fact it did not display the password (as it must do).
I can confirm that SSMS worked well at this point, it was entirely my fault, thanks for your time.
You are most welcome and I am glad to hear that all was solved :)