Skip to content

Latest commit

 

History

History
30 lines (25 loc) · 1.33 KB

change-docker-password.md

File metadata and controls

30 lines (25 loc) · 1.33 KB
author ms.author ms.date ms.service ms.subservice ms.topic ms.custom
rwestMSFT
randolphwest
11/18/2024
sql
linux
include
linux-related-content

The sa account is a system administrator on the [!INCLUDE ssnoversion-md] instance that's created during setup. After you create your [!INCLUDE ssnoversion-md] container, the MSSQL_SA_PASSWORD environment variable you specified is discoverable by running echo $MSSQL_SA_PASSWORD in the container. For security purposes, change your sa password:

  1. Choose a strong password to use for the sa account. [!INCLUDE password-complexity]

  2. Use docker exec to run the sqlcmd utility to change the password through a Transact-SQL statement. Replace <old-password> and <new-password> with your own password values:

    [!IMPORTANT]
    The SA_PASSWORD environment variable is deprecated. Use MSSQL_SA_PASSWORD instead.

    sudo docker exec -it sql1 /opt/mssql-tools/bin/sqlcmd \
       -S localhost -U sa -P '<old-password>' \
       -Q 'ALTER LOGIN sa WITH PASSWORD="<new-password>"'
    docker exec -it sql1 /opt/mssql-tools/bin/sqlcmd `
       -S localhost -U sa -P "<old-password>" `
       -Q "ALTER LOGIN sa WITH PASSWORD='<new-password>'"