Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Login failed for SA when running SQL Server on Linux caused by wrong documentation on environment variable #640

Open
vriesmarcel opened this issue Sep 12, 2020 · 0 comments

Comments

@vriesmarcel
Copy link

vriesmarcel commented Sep 12, 2020

TLDR;
It seems the documentation on how to start the Linux based sql server container contains a bug!
The documentation states you need to start the container using the following command-line:

docker run -e 'ACCEPT_EULA=Y' -e 'SA_PASSWORD=yourStrong(!)Password' -p 1433:1433 -d mcr.microsoft.com/mssql/server:2019-latest

But this is wrong because it will not set the password for SA

It took me hours to discover the environment variable actually used to set the SA password is 'MSSQL_SA_PASSWORD'

So when you use the following command line it just works

docker run -e 'ACCEPT_EULA=Y' -e 'MSSQL_SA_PASSWORD=yourStrong(!)Password' -p 1433:1433 -d mcr.microsoft.com/mssql/server:2019-latest

Steps to reproduce:

  • Run the command-line as advertised in the documentation to start the container.
  • Run a docker exec command to run a bash shell in the container interactively
  • Run the following command:
/opt/mssql-tools/bin/sqlcmd -S localhost -U SA -P 'yourStrong(!)Password'

This will give you the following error:

Sqlcmd: Error: Microsoft ODBC Driver 17 for SQL Server : Login failed for user 'SA'..

Now remove the container and try again, but replace the -e 'SA_PASSWORD=yourStrong(!)Password' with -e 'MSSQL_SA_PASSWORD=yourStrong(!)Password'

Try the same steps again, and voila, you are connected to the SQL server.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant