none
SA login to SQLServer Express failing!! RRS feed

  • Question

  • All,

    I created the "SQLServer Express" by downloading the image and running the below docker command.

    docker run -d --name sqlexpress -d -p 1434:1433 -e sa_password='docker123' -e ACCEPT_EULA=Y -it microsoft/mssql-server-windows-express cmd.exe

    However, when I try to login to the SQL Instance (even within the container) using "SQLCMD -Usa -Pdocker123 -SIPAddress,1433" I get "Password: Sqlcmd: Error: Microsoft ODBC Driver 13 for SQL Server : Login failed for user 'sa'." error.

    The ERRORLOG has the entry:

    2019-01-05 22:04:01.02 Logon       Login failed for user 'sa'. Reason: An error occurred while evaluating the password.

    The only way then to connect to the instance is by running "SQLCMD -E".

    Am I making a mistake or am I unaware of the way SQLServer Express in a container?

    thanks,

    rgn


    • Edited by grajee Sunday, January 6, 2019 3:07 AM Updated entry from ERRORLOG
    Sunday, January 6, 2019 2:50 AM

All replies

  • I stopped (docker stop sqlexpress) and removed (docker rm sqlexpress) the container. I initiated it once again as before and this time I ran SQLCMD -E to check if the login is disabled to being with. And it is disabled and the reason why all attempt to connect to it using SA was failing.

    The question is why would the SA login be disabled to begin with?

    Here is a image history of SQL Express

    C:\>docker image history  microsoft/mssql-server-windows-express

    IMAGE               CREATED             CREATED BY                                      SIZE                COMMENT
    1986b8a8f950        11 months ago       powershell -Command $ErrorActionPreference =…   41kB
    <missing>           11 months ago       powershell -Command $ErrorActionPreference =…   124MB
    <missing>           11 months ago       powershell -Command $ErrorActionPreference =…   2.36GB
    <missing>           11 months ago       powershell -Command $ErrorActionPreference =…   41kB
    <missing>           11 months ago       powershell -Command $ErrorActionPreference =…   844MB
    <missing>           11 months ago       powershell -Command $ErrorActionPreference =…   43.1kB
    <missing>           11 months ago       powershell -Command $ErrorActionPreference =…   41kB
    <missing>           11 months ago       cmd /S /C #(nop)  ENV sa_password=_ attach_d…   41kB
    <missing>           11 months ago       cmd /S /C #(nop)  ENV sql_express_download_u…   41kB
    <missing>           11 months ago       cmd /S /C #(nop)  LABEL maintainer=Perry Sko…   41kB
    <missing>           12 months ago       Install update 10.0.14393.2007                  2.76GB
    <missing>           2 years ago         Apply image 10.0.14393.0                        7.68GB

    Sunday, January 6, 2019 3:21 AM
  • Greetings,

    Please run following command instead.

    docker run -d -p 1433:1433 -e sa_password=<SA_PASSWORD> -e ACCEPT_EULA=Y microsoft/mssql-server-windows-express

    What's the purpose for adding "cmd.exe" at the end of your command?


    Sic Parvis Magna

    Monday, January 7, 2019 11:29 AM
  • This did not work :-

    docker run -d -p 1433:1433 -e sa_password=Docker!23 -e ACCEPT_EULA=Y microsoft/mssql-server-windows-express

    I could not even stop the container using any of the below. I eventually had to restart my desktop

    docker stop wizardly_shockley
    docker rm wizardly_shockley
    docker rm --force wizardly_shockley


    Wednesday, January 9, 2019 4:38 AM
  • Greetings,

    Because you specify -d in the command, the container is running in the background. After some time, you can connect to 1433 to check the availability of sqlserver.

    Before stopping a container, you should check the name of container via docker ps.


    Sic Parvis Magna

    Wednesday, January 9, 2019 6:38 AM