Skip to content

Latest commit

 

History

History
30 lines (25 loc) · 1.22 KB

change-docker-password.md

File metadata and controls

30 lines (25 loc) · 1.22 KB
author rwestMSFT
ms.author randolphwest
ms.date 06/14/2023
ms.service sql
ms.subservice linux
ms.topic include
ms.custom
linux-related-content

The SA account is a system administrator on the SQL Server instance that's created during setup. After you create your SQL Server 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 user.

  2. Use docker exec to run the sqlcmd utility to change the password through a Transact-SQL statement. Replace <YourStrong!Passw0rd> and <YourNewStrong!Passw0rd> 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 '<YourStrong!Passw0rd>' \
       -Q 'ALTER LOGIN SA WITH PASSWORD="<YourNewStrong!Passw0rd>"'
    docker exec -it sql1 /opt/mssql-tools/bin/sqlcmd `
       -S localhost -U SA -P "<YourStrong!Passw0rd>" `
       -Q "ALTER LOGIN SA WITH PASSWORD='<YourNewStrong!Passw0rd>'"