简体   繁体   中英

Login failed while connecting to SQL server using MacOS terminal

I'm trying to create a Distributed SQL Server Cache table for a .NET Core project using this command:

dotnet sql-cache create "Server=localhost;Database=CacheDb;User Id=SA;Password=Some123\;@#;" dbo DataCache

The password is Some123!@# , so I'm trying to escape the special characters using \ but it doesn't see to work as I'm getting: An error occurred. Login failed for user 'SA'. An error occurred. Login failed for user 'SA'.

I have an image of microsoft/mssql-server-linux running in a docker container. The version is Microsoft SQL Server 2017 (RTM-CU13) (KB4466404) - 14.0.3048.4 (X64) .

I'm able to run my web applications using that connection string (without needing to escape special characters), but I'm unable to make that connection string work using Terminal command.

Any help is appreciated. Thank you!

\! in double quote will still be \! . You can use single quotes:

[STEP 101] $ echo "Some123!@#"
bash: !@#: event not found
[STEP 102] $ echo "Some123\!@#"
Some123\!@#
[STEP 103] $ echo 'Some123!@#'
Some123!@#
[STEP 104] $

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM