

本文為英文版的機器翻譯版本，如內容有任何歧義或不一致之處，概以英文版為準。

# MySQL 的參數
<a name="Appendix.MySQL.Parameters"></a>

依預設，MySQL 資料庫執行個體會使用 MySQL 資料庫專用的資料庫參數群組。此參數群組包含 MySQL 資料庫引擎的參數。如需使用參數群組和設定參數的相關資訊，請參閱[Amazon RDS 的參數群組](USER_WorkingWithParamGroups.md)。

RDS for MySQL 參數會設為您已選取之儲存引擎的預設值。如需 MySQL 參數的詳細資訊，請參閱 [MySQL 文件](https://dev.mysql.com/doc/refman/8.0/en/server-system-variables.html)。如需 MySQL 儲存引擎的詳細資訊，請參閱 [支援的 RDS for MySQL 儲存引擎](MySQL.Concepts.FeatureSupport.md#MySQL.Concepts.Storage)。

您可以使用 RDS 主控台或 AWS CLI 查看特定 RDS for MySQL 版本的可用參數。如需有關在 RDS 主控台中查看 MySQL 參數群組參數的資訊，請參閱 [在 Amazon RDS 中檢視資料庫參數群組的參數值](USER_WorkingWithParamGroups.Viewing.md)。

藉由 AWS CLI，您可以執行 [https://docs.aws.amazon.com/cli/latest/reference/rds/describe-engine-default-parameters.html](https://docs.aws.amazon.com/cli/latest/reference/rds/describe-engine-default-parameters.html) 命令來查看 RDS for MySQL 版本的參數。為 `--db-parameter-group-family` 選項指定下列其中一個值：
+ `mysql8.4`
+ `mysql8.0`
+ `mysql5.7`

例如，若要檢視 RDS for MySQL 8.0 版的參數，請執行下列命令。

```
aws rds describe-engine-default-parameters --db-parameter-group-family mysql8.0
```

您的輸出結果類似以下內容。

```
{
    "EngineDefaults": {
        "Parameters": [
            {
                "ParameterName": "activate_all_roles_on_login",
                "ParameterValue": "0",
                "Description": "Automatically set all granted roles as active after the user has authenticated successfully.",
                "Source": "engine-default",
                "ApplyType": "dynamic",
                "DataType": "boolean",
                "AllowedValues": "0,1",
                "IsModifiable": true
            },
            {
                "ParameterName": "allow-suspicious-udfs",
                "Description": "Controls whether user-defined functions that have only an xxx symbol for the main function can be loaded",
                "Source": "engine-default",
                "ApplyType": "static",
                "DataType": "boolean",
                "AllowedValues": "0,1",
                "IsModifiable": false
            },
            {
                "ParameterName": "auto_generate_certs",
                "Description": "Controls whether the server autogenerates SSL key and certificate files in the data directory, if they do not already exist.",
                "Source": "engine-default",
                "ApplyType": "static",
                "DataType": "boolean",
                "AllowedValues": "0,1",
                "IsModifiable": false
            },            
        ...
```

若要檢視 RDS for MySQL 8.0 版的可修改參數，請執行下列命令。

對於 Linux、macOS 或 Unix：

```
aws rds describe-engine-default-parameters --db-parameter-group-family mysql8.0 \
   --query 'EngineDefaults.Parameters[?IsModifiable==`true`]'
```

在 Windows 中：

```
aws rds describe-engine-default-parameters --db-parameter-group-family mysql8.0 ^
   --query "EngineDefaults.Parameters[?IsModifiable==`true`]"
```