Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Applies to:
SQL Server - Linux
You can use several different environment variables to configure SQL Server on Linux. These variables are used in two scenarios:
- To configure initial setup with the
mssql-conf setupcommand. - To configure a new SQL Server Linux container image.
Tip
If you need to configure SQL Server after these setup scenarios, see Configure SQL Server on Linux with the mssql-conf tool.
Environment variables
| Environment variable | Description |
|---|---|
ACCEPT_EULA |
Set the ACCEPT_EULA variable to any value to confirm your acceptance of the End-User Licensing Agreement. Required setting for the SQL Server image. |
MSSQL_SA_PASSWORD |
Configure the sa password.The SA_PASSWORD environment variable is deprecated. Use MSSQL_SA_PASSWORD instead. |
MSSQL_PID |
Set the SQL Server edition or product key. Possible values are listed in the following SQL Server editions table. If you specify a product key, it must be in the form of #####-#####-#####-#####-#####, where # is a number or a letter. |
MSSQL_LCID |
Sets the language ID to use for SQL Server. For example, 1036 is French. |
MSSQL_COLLATION |
Sets the default collation for SQL Server. This overrides the default mapping of language ID (LCID) to collation. |
MSSQL_MEMORY_LIMIT_MB |
Sets the maximum amount of memory (in MB) that SQL Server can use. By default, it's 80% of the total physical memory. |
MSSQL_TCP_PORT |
Configure the TCP port that SQL Server listens on (default 1433). |
MSSQL_IP_ADDRESS |
Set the IP address. Currently, the IP address must be IPv4 style (0.0.0.0). |
MSSQL_BACKUP_DIR |
Set the Default backup directory ___location. |
MSSQL_DATA_DIR |
Change the directory where the new SQL Server database data files (.mdf) are created. |
MSSQL_LOG_DIR |
Change the directory where the new SQL Server database log (.ldf) files are created. |
MSSQL_DUMP_DIR |
Change the directory where SQL Server deposits the memory dumps and other troubleshooting files by default. |
MSSQL_ENABLE_HADR |
Enable Availability Group. For example, '1' is enabled, and '0' is disabled |
MSSQL_AGENT_ENABLED |
Enable SQL Server Agent. For example, 'true' is enabled and 'false' is disabled. By default, agent is disabled. |
MSSQL_MASTER_DATA_FILE |
Sets the ___location of the master database data file. Must be named master.mdf until first run of SQL Server. |
MSSQL_MASTER_LOG_FILE |
Sets the ___location of the master database log file. Must be named mastlog.ldf until first run of SQL Server. |
MSSQL_ERROR_LOG_FILE |
Sets the ___location of the errorlog files. For example, /var/opt/mssql/log/errorlog. |
SQL Server editions
MSSQL_PID |
Edition |
|---|---|
Evaluation |
SQL Server Evaluation edition |
Developer |
SQL Server Developer edition |
Express |
SQL Server Express edition |
Web |
SQL Server Web edition |
Standard |
SQL Server Standard edition |
Enterprise |
This legacy option represents Enterprise edition Server + Client Access License (CAL) based licensing, and is limited to a maximum of 20 cores per SQL Server instance. Enterprise isn't available for new agreements. You should choose EnterpriseCore when you wish to deploy Enterprise edition. |
EnterpriseCore |
SQL Server Enterprise Core edition. EnterpriseCore represents the core-based server licensing model with no core limits. For more information, see Compute capacity limits by edition of SQL Server. |
A product key |
If you specify a product key, it must be in the form of #####-#####-#####-#####-#####, where # is a number or a letter. |
For more information about these editions, see SQL Server editions.
MSSQL_PID |
Edition |
|---|---|
Evaluation |
SQL Server Evaluation edition |
Express |
SQL Server Express edition |
StandardDeveloper |
SQL Server Developer edition |
Standard |
SQL Server Standard edition |
EnterpriseDeveloper |
SQL Server Developer edition |
Enterprise |
This legacy option represents Enterprise edition Server + Client Access License (CAL) based licensing, and is limited to a maximum of 20 cores per SQL Server instance. Enterprise isn't available for new agreements. You should choose EnterpriseCore when you wish to deploy Enterprise edition. |
EnterpriseCore |
SQL Server Enterprise Core edition. EnterpriseCore represents the core-based server licensing model with no core limits. For more information, see Compute capacity limits by edition of SQL Server. |
A product key |
If you specify a product key, it must be in the form of #####-#####-#####-#####-#####, where # is a number or a letter. |
For more information about these editions, see SQL Server editions.
Use with initial setup
This example runs mssql-conf setup with configured environment variables. The following environment variables are specified:
ACCEPT_EULAaccepts the end user license agreement.MSSQL_PIDspecifies the freely licensed Developer Edition of SQL Server for non-production use.MSSQL_SA_PASSWORDsets a strong password. Your password should follow the SQL Server default password policy. By default, the password must be at least eight characters long and contain characters from three of the following four sets: uppercase letters, lowercase letters, base-10 digits, and symbols. Passwords can be up to 128 characters long. Use passwords that are as long and complex as possible.MSSQL_TCP_PORTsets the TCP port that SQL Server listens on to 1234.
sudo ACCEPT_EULA='Y' MSSQL_PID='Developer' MSSQL_SA_PASSWORD='<password>' MSSQL_TCP_PORT=1234 /opt/mssql/bin/mssql-conf setup
Use with Docker
This example docker command uses the following environment variables to create a new SQL Server container:
ACCEPT_EULAaccepts the end user license agreement.MSSQL_PIDspecifies the freely licensed Developer Edition of SQL Server for non-production use.When you deploy a container for SQL Server 2025 (17.x) or a later version, use
MSSQL_PID=DeveloperStandardfor Standard Developer edition, andMSSQL_PID=Developerfor Enterprise Developer edition.MSSQL_SA_PASSWORDsets a strong password. Your password should follow the SQL Server default password policy. By default, the password must be at least eight characters long and contain characters from three of the following four sets: uppercase letters, lowercase letters, base-10 digits, and symbols. Passwords can be up to 128 characters long. Use passwords that are as long and complex as possible.MSSQL_TCP_PORTsets the TCP port that SQL Server listens on to 1234. This means that instead of mapping port 1433 (default) to a host port, the custom TCP port must be mapped with the-p 1234:1234command in this example.
If you're running Docker on Linux, use the following syntax with single quotes:
docker run -e ACCEPT_EULA=Y -e MSSQL_PID='Developer' -e MSSQL_SA_PASSWORD='<password>' -e MSSQL_TCP_PORT=1234 -p 1234:1234 -d mcr.microsoft.com/mssql/server:2017-latest
If you're running Docker on Windows, use the following syntax with double quotes:
docker run -e ACCEPT_EULA=Y -e MSSQL_PID="Developer" -e MSSQL_SA_PASSWORD="<password>" -e MSSQL_TCP_PORT=1234 -p 1234:1234 -d mcr.microsoft.com/mssql/server:2017-latest
Note
The process for running production editions in containers is slightly different. For more information, see Run production container images.
If you're running Docker on Linux, use the following syntax with single quotes:
docker run -e ACCEPT_EULA=Y -e MSSQL_PID='Developer' -e MSSQL_SA_PASSWORD='<password>' -e MSSQL_TCP_PORT=1234 -p 1234:1234 -d mcr.microsoft.com/mssql/server:2019-latest
If you're running Docker on Windows, use the following syntax with double quotes:
docker run -e ACCEPT_EULA=Y -e MSSQL_PID="Developer" -e MSSQL_SA_PASSWORD="<password>" -e MSSQL_TCP_PORT=1234 -p 1234:1234 -d mcr.microsoft.com/mssql/server:2019-latest
If you're running Docker on Linux, use the following syntax with single quotes:
docker run -e ACCEPT_EULA=Y -e MSSQL_PID='Developer' -e MSSQL_SA_PASSWORD='<password>' -e MSSQL_TCP_PORT=1234 -p 1234:1234 -d mcr.microsoft.com/mssql/server:2022-latest
If you're running Docker on Windows, use the following syntax with double quotes:
docker run -e ACCEPT_EULA=Y -e MSSQL_PID="Developer" -e MSSQL_SA_PASSWORD="<password>" -e MSSQL_TCP_PORT=1234 -p 1234:1234 -d mcr.microsoft.com/mssql/server:2022-latest
If you're running Docker on Linux, use the following syntax with single quotes:
docker run -e ACCEPT_EULA=Y -e MSSQL_PID='Developer' -e MSSQL_SA_PASSWORD='<password>' -e MSSQL_TCP_PORT=1234 -p 1234:1234 -d mcr.microsoft.com/mssql/server:2025-latest
If you're running Docker on Windows, use the following syntax with double quotes:
docker run -e ACCEPT_EULA=Y -e MSSQL_PID="Developer" -e MSSQL_SA_PASSWORD="<password>" -e MSSQL_TCP_PORT=1234 -p 1234:1234 -d mcr.microsoft.com/mssql/server:2025-latest
When you deploy a container for SQL Server 2025 (17.x) or a later version, use MSSQL_PID=DeveloperStandard for Standard Developer edition, and MSSQL_PID=Developer for Enterprise Developer edition.
Caution
Your password should follow the SQL Server default password policy. By default, the password must be at least eight characters long and contain characters from three of the following four sets: uppercase letters, lowercase letters, base-10 digits, and symbols. Passwords can be up to 128 characters long. Use passwords that are as long and complex as possible.
Related content
- Configure SQL Server on Linux with the mssql-conf tool
- Installation guidance for SQL Server on Linux
Contribute to SQL documentation
Did you know that you can edit SQL content yourself? If you do so, not only do you help improve our documentation, but you also get credited as a contributor to the page.
For more information, see Edit Microsoft Learn documentation.