Configure SQL Server settings with environment variables on Linux

Source: Internet
Author: User
Tags mssql strong password docker run

You can use different environment variables to configure SQL Server 2017 on Linux. These variables are used in two scenarios:

    • Use the mssql-conf Setup command to configure initialization settings.

    • Configure SQL Server in a new Docker container.


Environment Variables

Environment variables

Describe

Accept_eula

Accept the SQL Server License Agreement when set to any value (for example, "Y").

Mssql_sa_password

Configure the SA user password.

Mssql_pid

Set the SQL Server version or product key. Possible values include the following:
Evaluation
Development staff
Express
Web
Standard
Enterprise Edition
Product Key
If you specify a product key, it must be formatted as # # # #-# # #-# # #-# # #-# # #, where # is a number or letter.

Mssql_lcid

Set the language ID to use for SQL Server. For example 1036 for French.

Mssql_collation

Sets the default collation for SQL Server. This overrides the default mapping for the language ID (LCID) of the collation.

Mssql_memory_limit_mb

Sets the maximum amount of memory (in megabytes) that SQL Server can use. By default, it is 80% of total physical memory.

Mssql_tcp_port

Configures the TCP port that SQL Server listens on (default is 1433).

Mssql_ip_address

Set the IP address. Currently, the IP address must be a IPv4 style (0.0.0.0).

Mssql_backup_dir

Sets the default backup directory location.

Mssql_data_dir

Change the directory where the new SQL Server database data file (. mdf) is created.

Mssql_log_dir

Change the directory in which the new SQL Server database log (. ldf) file is created.

Mssql_dump_dir

Change the default directory where SQL Server holds memory dumps and other troubleshooting files.

Mssql_enable_hadr

Enable the availability group. For example, "1" is enabled and "0" is disabled

Mssql_agent_enabled

Enable SQL Server Agent. For example, enable ' true ' and ' false ' are disabled. The proxy is disabled by default.

Mssql_master_data_file

Sets the location of the master database data file.

Mssql_master_log_file

Sets the location of the master database log file.

Mssql_error_log_file

Sets the location of the error log file.


Example: initial setup

This example runs the mssql-conf setup with the configured environment variables. Specify the following environment variables:

    • Accept_eula accepts the end User License agreement.

    • msssql_pid is used in a non-production environment that specifies a free licensed Developer edition of SQL Server.

    • Mssql_sa_password set a strong password.

    • mssql_tcp_port Sets the TCP port that SQL Server learns to listen on for 1234 years.


sudo accept_eula= ' Y ' mssql_pid= ' Developer ' mssql_sa_password= ' <yourstrong! Passw0rd> ' mssql_tcp_port=1234/opt/mssql/bin/mssql-conf Setup

Example: Docker

This example Docker command uses the following environment variables to create a new SQL Server 2017 container:

    • Accept_eula accepts the end User License agreement.

    • msssql_pid is used in a non-production environment that specifies a free licensed Developer edition of SQL Server.

    • Mssql_sa_password set a strong password.

    • mssql_tcp_port Sets the TCP port that SQL Server learns to listen on for 1234 years. This means that instead of mapping port 1433 (the default) to the host port, you must map the custom TCP port with the-P 1234:1234 command in this example.


If you are running Docker on Linux/macos, use the following syntax with single quotes:

Docker run-e accept_eula=y-e mssql_pid= ' Developer '-e mssql_sa_password= ' <yourstrong! Passw0rd> '-e mssql_tcp_port=1234-p 1234:1234-d microsoft/mssql-server-linux:2017-latest


If you are running Docker on Windows, use the following syntax to enclose it in double quotation marks:

Docker run-e accept_eula=y-e mssql_pid= "Developer"-e mssql_sa_password= "<yourstrong! Passw0rd> "-E mssql_tcp_port=1234-p 1234:1234-d microsoft/mssql-server-linux:2017-latest


Configure SQL Server settings with environment variables on Linux

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.