Linux 上で環境変数を使って SQL Server の設定を構成するConfigure SQL Server settings with environment variables on Linux
適用対象:Applies to: SQL ServerSQL Server (サポートされているすべてのバージョン)
SQL ServerSQL Server (all supported versions)
SQL ServerSQL Server (サポートされているすべてのバージョン)
SQL ServerSQL Server (all supported versions)
Linux では、いくつかの異なる環境変数を使って SQL Server 2017 を構成することができます。You can use several different environment variables to configure SQL Server 2017 on Linux. このような変数は、次の 2 つのシナリオで使用されます。These variables are used in two scenarios:
Linux では、いくつかの異なる環境変数を使って SQL Server 2019 を構成することができます。You can use several different environment variables to configure SQL Server 2019 on Linux. このような変数は、次の 2 つのシナリオで使用されます。These variables are used in two scenarios:
mssql-conf setup
コマンドを使って初期セットアップを構成する。To configure initial setup with themssql-conf setup
command.- 新しい Docker の SQL Server コンテナーを構成する。To configure a new SQL Server container in Docker.
ヒント
これらのセットアップ シナリオの後に SQL Server を構成する必要がある場合は、「mssql-conf ツールを使用して SQL Server on Linux を構成する」をご覧ください。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_EULAACCEPT_EULA | ACCEPT_EULA 変数を任意の値に設定し、使用許諾契約書の承諾を確定します。Set the ACCEPT_EULA variable to any value to confirm your acceptance of the End-User Licensing Agreement. SQL Server イメージの設定が必要です。Required setting for the SQL Server image. |
MSSQL_SA_PASSWORDMSSQL_SA_PASSWORD | SA ユーザーのパスワードを構成します。Configure the SA user password. |
MSSQL_PIDMSSQL_PID | SQL Server のエディションまたはプロダクト キーを設定します。Set the SQL Server edition or product key. 指定できる値は、次のとおりです。Possible values include: 評価Evaluation開発者Developer ExpressExpressWebWeb StandardStandardEnterpriseEnterprise プロダクト キーA product key プロダクト キーを指定する場合は、#####-#####-#####-#####-##### という形式にする必要があります。ここで、'#' は数字または文字を表します。If specifying a product key, it must be in the form of #####-#####-#####-#####-#####, where '#' is a number or a letter. |
MSSQL_LCIDMSSQL_LCID | SQL Server に使用する言語 ID を設定します。Sets the language ID to use for SQL Server. たとえば、1036 はフランス語です。For example 1036 is French. |
MSSQL_COLLATIONMSSQL_COLLATION | SQL Server の既定の照合順序を設定します。Sets the default collation for SQL Server. これにより、言語 ID (LCID) から照合順序への既定のマッピングがオーバーライドされます。This overrides the default mapping of language id (LCID) to collation. |
MSSQL_MEMORY_LIMIT_MBMSSQL_MEMORY_LIMIT_MB | SQL Server が使用できるメモリの最大容量 (MB 単位) を設定します。Sets the maximum amount of memory (in MB) that SQL Server can use. 既定では、これは物理メモリの合計容量の 80% です。By default it is 80% of the total physical memory. |
MSSQL_TCP_PORTMSSQL_TCP_PORT | SQL Server がリッスンする TCP ポートを構成します (既定値は 1433)。Configure the TCP port that SQL Server listens on (default 1433). |
MSSQL_IP_ADDRESSMSSQL_IP_ADDRESS | IP アドレスを設定します。Set the IP address. 現在、IP アドレスは IPv4 形式 (0.0.0.0) である必要があります。Currently, the IP address must be IPv4 style (0.0.0.0). |
MSSQL_BACKUP_DIRMSSQL_BACKUP_DIR | 既定のバックアップ ディレクトリの場所を設定します。Set the Default backup directory location. |
MSSQL_DATA_DIRMSSQL_DATA_DIR | 新しい SQL Server データベースのデータ ファイル (.mdf) が作成されるディレクトリを変更します。Change the directory where the new SQL Server database data files (.mdf) are created. |
MSSQL_LOG_DIRMSSQL_LOG_DIR | 新しい SQL Server データベースのログ (.ldf) ファイルが作成されるディレクトリを変更します。Change the directory where the new SQL Server database log (.ldf) files are created. |
MSSQL_DUMP_DIRMSSQL_DUMP_DIR | SQL Server が、メモリ ダンプやその他のトラブルシューティング ファイルを格納する既定のディレクトリを変更します。Change the directory where SQL Server will deposit the memory dumps and other troubleshooting files by default. |
MSSQL_ENABLE_HADRMSSQL_ENABLE_HADR | 可用性グループを有効にします。Enable Availability Group. たとえば、'1' は有効、'0' は無効ですFor example, '1' is enabled, and '0' is disabled |
MSSQL_AGENT_ENABLEDMSSQL_AGENT_ENABLED | SQL Server エージェントを有効にします。Enable SQL Server Agent. たとえば、'true' は有効、'false' は無効です。For example, 'true' is enabled and 'false' is disabled. 既定では、エージェントは無効になっています。By default, agent is disabled. |
MSSQL_MASTER_DATA_FILEMSSQL_MASTER_DATA_FILE | マスター データベースのデータ ファイルの場所を設定します。Sets the location of the master database data file. SQL Server を最初に実行するまでは、master.mdf という名前を付ける必要があります。Must be named master.mdf until first run of SQL Server. |
MSSQL_MASTER_LOG_FILEMSSQL_MASTER_LOG_FILE | マスター データベースのログ ファイルの場所を設定します。Sets the location of the master database log file. SQL Server を最初に実行するまでは、mastlog.ldf という名前を付ける必要があります。Must be named mastlog.ldf until first run of SQL Server. |
MSSQL_ERROR_LOG_FILEMSSQL_ERROR_LOG_FILE | エラー ログ ファイルの場所を設定します。Sets the location of the errorlog files. |
環境変数Environment variable | 説明Description |
---|---|
ACCEPT_EULAACCEPT_EULA | ACCEPT_EULA 変数を任意の値に設定し、使用許諾契約書の承諾を確定します。Set the ACCEPT_EULA variable to any value to confirm your acceptance of the End-User Licensing Agreement. SQL Server イメージの設定が必要です。Required setting for the SQL Server image. |
MSSQL_SA_PASSWORDMSSQL_SA_PASSWORD | SA ユーザーのパスワードを構成します。Configure the SA user password. |
MSSQL_PIDMSSQL_PID | SQL Server のエディションまたはプロダクト キーを設定します。Set the SQL Server edition or product key. 指定できる値は、次のとおりです。Possible values include: 評価Evaluation開発者Developer ExpressExpressWebWeb StandardStandardEnterpriseEnterprise プロダクト キーA product key プロダクト キーを指定する場合は、#####-#####-#####-#####-##### という形式にする必要があります。ここで、'#' は数字または文字を表します。If specifying a product key, it must be in the form of #####-#####-#####-#####-#####, where '#' is a number or a letter. |
MSSQL_LCIDMSSQL_LCID | SQL Server に使用する言語 ID を設定します。Sets the language ID to use for SQL Server. たとえば、1036 はフランス語です。For example 1036 is French. |
MSSQL_COLLATIONMSSQL_COLLATION | SQL Server の既定の照合順序を設定します。Sets the default collation for SQL Server. これにより、言語 ID (LCID) から照合順序への既定のマッピングがオーバーライドされます。This overrides the default mapping of language id (LCID) to collation. |
MSSQL_MEMORY_LIMIT_MBMSSQL_MEMORY_LIMIT_MB | SQL Server が使用できるメモリの最大容量 (MB 単位) を設定します。Sets the maximum amount of memory (in MB) that SQL Server can use. 既定では、これは物理メモリの合計容量の 80% です。By default it is 80% of the total physical memory. |
MSSQL_TCP_PORTMSSQL_TCP_PORT | SQL Server がリッスンする TCP ポートを構成します (既定値は 1433)。Configure the TCP port that SQL Server listens on (default 1433). |
MSSQL_IP_ADDRESSMSSQL_IP_ADDRESS | IP アドレスを設定します。Set the IP address. 現在、IP アドレスは IPv4 形式 (0.0.0.0) である必要があります。Currently, the IP address must be IPv4 style (0.0.0.0). |
MSSQL_BACKUP_DIRMSSQL_BACKUP_DIR | 既定のバックアップ ディレクトリの場所を設定します。Set the Default backup directory location. |
MSSQL_DATA_DIRMSSQL_DATA_DIR | 新しい SQL Server データベースのデータ ファイル (.mdf) が作成されるディレクトリを変更します。Change the directory where the new SQL Server database data files (.mdf) are created. |
MSSQL_LOG_DIRMSSQL_LOG_DIR | 新しい SQL Server データベースのログ (.ldf) ファイルが作成されるディレクトリを変更します。Change the directory where the new SQL Server database log (.ldf) files are created. |
MSSQL_DUMP_DIRMSSQL_DUMP_DIR | SQL Server が、メモリ ダンプやその他のトラブルシューティング ファイルを格納する既定のディレクトリを変更します。Change the directory where SQL Server will deposit the memory dumps and other troubleshooting files by default. |
MSSQL_ENABLE_HADRMSSQL_ENABLE_HADR | 可用性グループを有効にします。Enable Availability Group. たとえば、'1' は有効、'0' は無効ですFor example, '1' is enabled, and '0' is disabled |
MSSQL_AGENT_ENABLEDMSSQL_AGENT_ENABLED | SQL Server エージェントを有効にします。Enable SQL Server Agent. たとえば、'true' は有効、'false' は無効です。For example, 'true' is enabled and 'false' is disabled. 既定では、エージェントは無効になっています。By default, agent is disabled. |
MSSQL_MASTER_DATA_FILEMSSQL_MASTER_DATA_FILE | マスター データベースのデータ ファイルの場所を設定します。Sets the location of the master database data file. SQL Server を最初に実行するまでは、master.mdf という名前を付ける必要があります。Must be named master.mdf until first run of SQL Server. |
MSSQL_MASTER_LOG_FILEMSSQL_MASTER_LOG_FILE | マスター データベースのログ ファイルの場所を設定します。Sets the location of the master database log file. SQL Server を最初に実行するまでは、mastlog.ldf という名前を付ける必要があります。Must be named mastlog.ldf until first run of SQL Server. |
MSSQL_ERROR_LOG_FILEMSSQL_ERROR_LOG_FILE | エラー ログ ファイルの場所を設定します。Sets the location of the errorlog files. |
初期セットアップでの使用Use with initial setup
この例では、構成済みの環境変数を使って mssql-conf setup
を実行します。This example runs mssql-conf setup
with configured environment variables. 以下の環境変数が指定されています。The following environment variables are specified:
- ACCEPT_EULA: エンド ユーザー使用許諾契約に同意します。ACCEPT_EULA accepts the end user license agreement.
- MSSQL_PID: 非運用環境で使用するために、無料でライセンスが付与される Developer Edition の SQL Server を指定します。MSSQL_PID specifies the freely licensed Developer Edition of SQL Server for non-production use.
- MSSQL_SA_PASSWORD: 強力なパスワードを設定します。MSSQL_SA_PASSWORD sets a strong password.
- MSSQL_TCP_PORT: SQL Server がリッスンする TCP ポートを 1234 に設定します。MSSQL_TCP_PORT sets the TCP port that SQL Server listens on to 1234.
sudo ACCEPT_EULA='Y' MSSQL_PID='Developer' MSSQL_SA_PASSWORD='<YourStrong!Passw0rd>' MSSQL_TCP_PORT=1234 /opt/mssql/bin/mssql-conf setup
Docker での使用Use with Docker
この docker コマンドの例では、以下の環境変数を使って新しい SQL Server コンテナーを作成します。This example docker command uses the following environment variables to create a new SQL Server container:
- ACCEPT_EULA: エンド ユーザー使用許諾契約に同意します。ACCEPT_EULA accepts the end user license agreement.
- MSSQL_PID: 非運用環境で使用するために、無料でライセンスが付与される Developer Edition の SQL Server を指定します。MSSQL_PID specifies the freely licensed Developer Edition of SQL Server for non-production use.
- MSSQL_SA_PASSWORD: 強力なパスワードを設定します。MSSQL_SA_PASSWORD sets a strong password.
- MSSQL_TCP_PORT: SQL Server がリッスンする TCP ポートを 1234 に設定します。MSSQL_TCP_PORT sets the TCP port that SQL Server listens on to 1234. つまり、この例では、ホストのポートにポート 1433 (既定値) をマップするのではなく、
-p 1234:1234
コマンドを使ってカスタム TCP ポートをマップする必要があります。This means that instead of mapping port 1433 (default) to a host port, the custom TCP port must be mapped with the-p 1234:1234
command in this example.
Linux/macOS 上で Docker を実行している場合は、単一引用符を含む次の構文を使います。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 mcr.microsoft.com/mssql/server:2017-latest
Windows 上で Docker を実行している場合は、二重引用符を含む次の構文を使います。If you are 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="<YourStrong!Passw0rd>" -e MSSQL_TCP_PORT=1234 -p 1234:1234 -d mcr.microsoft.com/mssql/server:2017-latest
注意
コンテナーで実稼働エディションを実行するためのプロセスは若干異なります。The process for running production editions in containers is slightly different. 詳細については、「Run production container images」(実稼働のコンテナー イメージを実行する) を参照してください。For more information, see Run production container images.
Linux/macOS 上で Docker を実行している場合は、単一引用符を含む次の構文を使います。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 mcr.microsoft.com/mssql/server:2019-GA-ubuntu-16.04
Windows 上で Docker を実行している場合は、二重引用符を含む次の構文を使います。If you are 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="<YourStrong!Passw0rd>" -e MSSQL_TCP_PORT=1234 -p 1234:1234 -d mcr.microsoft.com/mssql/server:2019-GA-ubuntu-16.04
次のステップNext steps
ここに記載されていないその他の SQL Server 設定については、「mssql-conf ツールを使用して SQL Server on Linux を構成する」をご覧ください。For other SQL Server settings not listed here, see Configure SQL Server on Linux with the mssql-conf tool.
Linux 上に SQL Server をインストールして実行する方法について詳しくは、Linux への SQL Server のインストールに関する記事をご覧ください。For more information on how to install and run SQL Server on Linux, see Install SQL Server on Linux.