你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn

az mysql flexible-server

注意

此命令组具有在 Azure CLI 和至少一个扩展中定义的命令。 安装每个扩展,使其受益于其扩展功能。 详细了解扩展。

管理 Azure Database for MySQL 灵活服务器。

命令

名称 说明 类型 状态
az mysql flexible-server ad-admin

管理服务器 Active Directory 管理员。

核心 GA
az mysql flexible-server ad-admin create

创建 Active Directory 管理员。

核心 GA
az mysql flexible-server ad-admin delete

删除 Active Directory 管理员。

核心 GA
az mysql flexible-server ad-admin list

列出所有 Active Directory 管理员。

核心 GA
az mysql flexible-server ad-admin show

获取 Active Directory 管理员。

核心 GA
az mysql flexible-server ad-admin wait

等待 Active Directory 管理员满足某些条件。

核心 GA
az mysql flexible-server advanced-threat-protection-setting

管理服务器的高级威胁防护设置。

核心 GA
az mysql flexible-server advanced-threat-protection-setting show

获取服务器的高级威胁防护设置。

核心 GA
az mysql flexible-server advanced-threat-protection-setting update

更新服务器上的高级威胁防护设置。

核心 GA
az mysql flexible-server backup

管理灵活的服务器备份。

核心 GA
az mysql flexible-server backup create

为具有指定备份名称的给定服务器创建备份。

核心 GA
az mysql flexible-server backup list

列出给定服务器的所有备份。

核心 GA
az mysql flexible-server backup show

显示给定服务器的特定备份的详细信息。

核心 GA
az mysql flexible-server connect

连接灵活服务器。

扩展 GA
az mysql flexible-server create

创建 MySQL 灵活服务器。

核心 GA
az mysql flexible-server db

管理灵活服务器上的 MySQL 数据库。

核心 GA
az mysql flexible-server db create

在灵活服务器上创建 MySQL 数据库。

核心 GA
az mysql flexible-server db delete

删除灵活服务器上的数据库。

核心 GA
az mysql flexible-server db list

列出灵活服务器的数据库。

核心 GA
az mysql flexible-server db show

显示数据库的详细信息。

核心 GA
az mysql flexible-server delete

删除灵活服务器。

核心 GA
az mysql flexible-server deploy

为 MySQL 服务器启用并运行 GitHub Actions 工作流。

核心 GA
az mysql flexible-server deploy run

在 github 存储库中运行现有工作流。

核心 GA
az mysql flexible-server deploy setup

为 MySQL 服务器创建 GitHub Actions 工作流文件。

核心 GA
az mysql flexible-server execute

连接灵活服务器。

扩展 GA
az mysql flexible-server export

管理服务器上的导出备份。

核心 预览
az mysql flexible-server export create

为具有指定备份名称的给定服务器创建导出备份。

核心 预览
az mysql flexible-server firewall-rule

管理服务器的防火墙规则。

核心 GA
az mysql flexible-server firewall-rule create

为灵活服务器创建新的防火墙规则。

核心 GA
az mysql flexible-server firewall-rule delete

删除防火墙规则。

核心 GA
az mysql flexible-server firewall-rule list

列出灵活服务器的所有防火墙规则。

核心 GA
az mysql flexible-server firewall-rule show

获取防火墙规则的详细信息。

核心 GA
az mysql flexible-server firewall-rule update

更新防火墙规则。

核心 GA
az mysql flexible-server geo-restore

从备份中异地还原灵活服务器。

核心 GA
az mysql flexible-server gtid

管理服务器上的 GTID。

核心 GA
az mysql flexible-server gtid reset

重置服务器上的 GTID。

核心 GA
az mysql flexible-server identity

管理服务器用户分配的标识。

核心 GA
az mysql flexible-server identity assign

将用户签名的托管标识添加到服务器。

核心 GA
az mysql flexible-server identity list

列出服务器中的所有用户分配的托管标识。

核心 GA
az mysql flexible-server identity remove

从服务器中删除用户签名的托管标识。

核心 GA
az mysql flexible-server identity show

从服务器获取用户分配的托管标识。

核心 GA
az mysql flexible-server import

管理 MySQL 灵活服务器的导入工作流。

核心 GA
az mysql flexible-server import create

为灵活服务器创建新的导入工作流。

核心 GA
az mysql flexible-server list

列出可用的灵活服务器。

核心 GA
az mysql flexible-server list-skus

列出给定区域中的可用 SKU。

核心 GA
az mysql flexible-server parameter

用于管理灵活服务器的服务器参数值的命令。

核心 GA
az mysql flexible-server parameter list

列出灵活服务器的参数值。

核心 GA
az mysql flexible-server parameter set

更新灵活服务器的参数。

核心 GA
az mysql flexible-server parameter set-batch

灵活服务器的批处理更新参数。

核心 GA
az mysql flexible-server parameter show

获取灵活服务器的参数。”

核心 GA
az mysql flexible-server replica

管理读取副本 (replica)。

核心 GA
az mysql flexible-server replica create

创建服务器的只读副本。

核心 GA
az mysql flexible-server replica list

列出某个给定服务器的所有只读副本。

核心 GA
az mysql flexible-server replica stop-replication

停止复制到只读副本,并使该副本成为读/写服务器。

核心 GA
az mysql flexible-server restart

重启灵活服务器。

核心 GA
az mysql flexible-server restore

从备份还原灵活服务器。

核心 GA
az mysql flexible-server server-logs

管理服务器日志。

核心 GA
az mysql flexible-server server-logs download

下载日志文件。

核心 GA
az mysql flexible-server server-logs list

列出服务器的日志文件。

核心 GA
az mysql flexible-server show

获取灵活服务器的详细信息。

核心 GA
az mysql flexible-server show-connection-string

显示 MySQL 灵活服务器数据库的连接字符串。

核心 GA
az mysql flexible-server start

启动灵活服务器。

核心 GA
az mysql flexible-server stop

停止灵活服务器。

核心 GA
az mysql flexible-server update

更新灵活服务器。

核心 GA
az mysql flexible-server upgrade

升级灵活服务器的主版本。

核心 GA
az mysql flexible-server wait

等待灵活服务器满足某些条件。

核心 GA

az mysql flexible-server connect

连接灵活服务器。

az mysql flexible-server connect --admin-user
                                 --name
                                 [--admin-password]
                                 [--database-name]
                                 [--interactive]
                                 [--querytext]

必需参数

--admin-user -u

管理员的登录用户名。

--name -n

服务器的名称。 名称只能包含小写字母、数字和连字符 (-)。 最少 3 个字符,最多 63 个字符。

可选参数

--admin-password -p

管理员的登录密码。

--database-name -d

数据库的名称。

--interactive

传递此参数以在交互模式下连接到数据库。

--querytext -q
已放弃

参数“querytext”已弃用,将在将来的版本中删除。 请改用“执行”。

要针对灵活服务器运行的查询。

全局参数
--debug

提高日志记录详细程度以显示所有调试日志。

--help -h

显示此帮助消息并退出。

--only-show-errors

只显示错误,取消显示警告。

--output -o

输出格式。

接受的值: json, jsonc, none, table, tsv, yaml, yamlc
默认值: json
--query

JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/

--subscription

订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID 配置默认订阅。

--verbose

提高日志记录详细程度。 使用 --debug 获取完整的调试日志。

az mysql flexible-server create

创建 MySQL 灵活服务器。

使用自定义或默认配置创建 MySQL 灵活服务器。 有关网络配置的详细信息,请参阅

az mysql flexible-server create [--address-prefixes]
                                [--admin-password]
                                [--admin-user]
                                [--auto-scale-iops {Disabled, Enabled}]
                                [--backup-identity]
                                [--backup-key]
                                [--backup-retention]
                                [--database-name]
                                [--geo-redundant-backup {Disabled, Enabled}]
                                [--high-availability {Disabled, SameZone, ZoneRedundant}]
                                [--identity]
                                [--iops]
                                [--key]
                                [--location]
                                [--name]
                                [--private-dns-zone]
                                [--public-access]
                                [--resource-group]
                                [--sku-name]
                                [--standby-zone]
                                [--storage-auto-grow {Disabled, Enabled}]
                                [--storage-size]
                                [--subnet]
                                [--subnet-prefixes]
                                [--tags]
                                [--tier]
                                [--version]
                                [--vnet]
                                [--yes]
                                [--zone]

示例

使用自定义参数创建 MySQL 灵活服务器

az mysql flexible-server create --location northeurope --resource-group testGroup \
  --name testserver --admin-user username --admin-password password \
  --sku-name Standard_B1ms --tier Burstable --public-access 0.0.0.0 --storage-size 32 \
  --tags "key=value" --version 5.7 --high-availability ZoneRedundant --zone 1 \
  --standby-zone 3 --storage-auto-grow Enabled --iops 500

创建默认参数和启用公共访问的 MySQL 灵活服务器。 资源组、服务器名称、用户名、密码和默认数据库将由 CLI 创建

az mysql flexible-server create

创建具有公共访问权限的 MySQL 灵活服务器,并添加 IP 地址范围以访问此服务器。 --public-access 参数可以是“All”、“None”或 <startIpAddress><startIpAddress>-<endIpAddress>

az mysql flexible-server create --resource-group testGroup --name testserver --public-access 125.23.54.31-125.23.54.35

创建具有专用访问权限的 MySQL 灵活服务器。 如果提供的虚拟网络和子网不存在,则会创建具有指定地址前缀的虚拟网络和子网。

az mysql flexible-server create --resource-group testGroup --name testserver --vnet myVnet --subnet mySubnet --address-prefixes 10.0.0.0/16 --subnet-prefixes 10.0.0.0/24

使用新的子网资源 ID 和新的专用 DNS 区域资源 ID 创建 MySQL 灵活服务器。 可以在不同的订阅或资源组中创建子网和 DNS 区域。

az mysql flexible-server create \
  --resource-group testGroup --name testserver \
  --subnet /subscriptions/{SubID}/resourceGroups/{ResourceGroup}/providers/Microsoft.Network/virtualNetworks/{VNetName}/subnets/{SubnetName} \
  --private-dns-zone /subscriptions/{SubID}/resourceGroups/{resourceGroup}/providers/Microsoft.Network/privateDnsZones/testMySQLFlexibleDnsZone.private.mysql.database.azure.com \
  --address-prefixes 172.0.0.0/16 --subnet-prefixes 172.0.0.0/24

使用同一资源组中的现有网络资源创建 MySQL 灵活服务器。 提供的子网不应部署任何其他资源,并且此子网将委派给 Microsoft.DBforMySQL/flexibleServers(如果尚未委派)。 如果尚未链接,专用 DNS 区域将链接到虚拟网络。

# create vnet
az network vnet create --resource-group testGroup --name testVnet --location testLocation --address-prefixes 172.0.0.0/16

# create subnet
az network vnet subnet create --resource-group testGroup --vnet-name testVnet --address-prefixes 172.0.0.0/24 --name testSubnet

# create private dns zone
az network private-dns zone create -g testGroup -n testDNS.private.mysql.database.azure.com

az mysql flexible-server create --resource-group testGroup \
  --name testserver --location testLocation \
  --subnet /subscriptions/{SubId}/resourceGroups/{testGroup}/providers/Microsoft.Network/virtualNetworks/tesetVnet/subnets/testSubnet \
  --private-dns-zone /subscriptions/{SubId}/resourceGroups/{testGroup}/providers/Microsoft.Network/privateDnsZones/testDNS.mysql.database.azure.com\


az mysql flexible-server create --resource-group testGroup --name testserver \
  --vnet testVnet --subnet testSubnet --location testLocation \
  --private-dns-zone /subscriptions/{SubId}/resourceGroups/{testGroup}/providers/Microsoft.Network/privateDnsZones/testDNS.mysql.database.azure.com

使用不同的资源组/订阅中的现有网络资源创建 MySQL 灵活服务器。

az mysql flexible-server create --resource-group testGroup \
   --name testserver --location testLocation \
  --subnet /subscriptions/{SubId2}/resourceGroups/{testGroup2}/providers/Microsoft.Network/virtualNetworks/tesetVnet/subnets/testSubnet \
  --private-dns-zone /subscriptions/{SubId2}/resourceGroups/{testGroup2}/providers/Microsoft.Network/privateDnsZones/testDNS.mysql.database.azure.com

使用数据加密创建 MySQL 灵活服务器。

# create keyvault
az keyvault create -g testGroup -n testVault --location testLocation \
  --enable-purge-protection true


# create key in keyvault and save its key identifier
keyIdentifier=$(az keyvault key create --name testKey -p software \
  --vault-name testVault --query key.kid -o tsv)


# create identity and save its principalId
identityPrincipalId=$(az identity create -g testGroup --name testIdentity \
  --location testLocation --query principalId -o tsv)


# add testIdentity as an access policy with key permissions 'Wrap Key', 'Unwrap Key', 'Get' and 'List' inside testVault
az keyvault set-policy -g testGroup -n testVault --object-id $identityPrincipalId \
  --key-permissions wrapKey unwrapKey get list


# create flexible server with data encryption enabled
az mysql flexible-server create -g testGroup -n testServer --location testLocation \
  --key $keyIdentifier --identity testIdentity

创建具有异地冗余备份和数据加密的 MySQL 灵活服务器。

# create keyvault
az keyvault create -g testGroup -n testVault --location testLocation \
  --enable-purge-protection true


# create key in keyvault and save its key identifier
keyIdentifier=$(az keyvault key create --name testKey -p software \
  --vault-name testVault --query key.kid -o tsv)


# create identity and save its principalId
identityPrincipalId=$(az identity create -g testGroup --name testIdentity \
  --location testLocation --query principalId -o tsv)


# add testIdentity as an access policy with key permissions 'Wrap Key', 'Unwrap Key', 'Get' and 'List' inside testVault
az keyvault set-policy -g testGroup -n testVault --object-id $identityPrincipalId \
  --key-permissions wrapKey unwrapKey get list


# create backup keyvault
az keyvault create -g testGroup -n testBackupVault --location testBackupLocation \
  --enable-purge-protection true


# create backup key in backup keyvault and save its key identifier
backupKeyIdentifier=$(az keyvault key create --name testBackupKey -p software \
  --vault-name testBackupVault --query key.kid -o tsv)


# create backup identity and save its principalId
backupIdentityPrincipalId=$(az identity create -g testGroup --name testBackupIdentity \
  --location testBackupLocation --query principalId -o tsv)


# add testBackupIdentity as an access policy with key permissions 'Wrap Key', 'Unwrap Key', 'Get' and 'List' inside testBackupVault
az keyvault set-policy -g testGroup -n testBackupVault \
  --object-id $backupIdentityPrincipalId --key-permissions wrapKey unwrapKey get list


# create flexible server with geo redundant backup and data encryption enabled
az mysql flexible-server create -g testGroup -n testServer --location testLocation \
  --geo-redundant-backup Enabled \
  --key $keyIdentifier --identity testIdentity \
  --backup-key $backupKeyIdentifier --backup-identity testBackupIdentity

可选参数

--address-prefixes

以 CIDR 格式创建新虚拟网络时要使用的 IP 地址前缀。 默认值为 10.0.0.0/16。

--admin-password -p

管理员的密码。 最少 8 个字符,最多 128 个字符。 密码必须包含以下类别中的三个类别的字符:英文大写字母、英文小写字母、数字和非字母数字字符。

--admin-user -u

服务器管理员istrator 用户名。 设置后,无法更改它。

默认值: unrulytomatoe6
--auto-scale-iops

启用或禁用自动缩放 iops。 默认值为 Disabled。

接受的值: Disabled, Enabled
默认值: Disabled
--backup-identity

用于数据加密的异地备份用户标识的名称或资源 ID。 标识需要与备份区域位于同一区域。

--backup-key

用于数据加密的异地备份 keyvault 密钥的资源 ID。 密钥需要与备份区域位于同一区域。

--backup-retention

备份保留的天数。 范围为 1 到 35 天。 默认值为 7 天。

默认值: 7
--database-name -d

预配数据库服务器时要创建的数据库的名称。

--geo-redundant-backup

是否启用异地冗余备份。

接受的值: Disabled, Enabled
默认值: Disabled
--high-availability

启用(ZoneRedundant 或 SameZone)或禁用高可用性功能。

接受的值: Disabled, SameZone, ZoneRedundant
默认值: Disabled
--identity

用于数据加密的用户分配的标识的名称或资源 ID。

--iops

为此服务器分配的 IOPS 数。 你将根据预配的计算和存储获得一定数量的免费 IOPS。 IOPS 的默认值为“空闲 IOPS”。 若要详细了解基于计算和存储的 IOPS,请参阅“Azure Database for MySQL 灵活服务器中的 IOPS”。

--key

用于数据加密的主密钥库密钥的资源 ID。

--location -l

位置。 az account list-locations 中的值。 可以使用 az configure --defaults location=<location> 配置默认位置。

--name -n

服务器的名称。 名称只能包含小写字母、数字和连字符 (-)。 最少 3 个字符,最多 63 个字符。

--private-dns-zone

仅当创建具有专用访问权限的跨区域副本 (replica)服务器时,此参数才适用。 对于具有专用访问的区域内读取副本 (replica),将传递源服务器设置,并忽略此参数。 新的或现有的专用 DNS 区域的名称或 ID。 可以使用同一资源组、不同资源组或不同订阅中的专用 DNS 区域。 如果要使用不同资源组或订阅中的区域,请提供资源 ID。如果用户未提供专用 DNS 区域,CLI 会在虚拟网络所在的资源组中创建一个新的。

--public-access

确定公共访问。 输入要包含在 IP 允许列表中的单个或一系列 IP 地址。 IP 地址范围必须用短划线分隔,并且不包含任何空格。 如果指定 0.0.0.0,则允许从 Azure 中部署的任何资源进行公共访问来访问服务器。 将其设置为“None”会将服务器设置为公共访问模式,但不创建防火墙规则。

--resource-group -g

资源组的名称。 可以使用 az configure --defaults group=<name> 配置默认组。

--sku-name

计算 SKU 的名称。 遵循Standard_{VM 名称}的约定。 示例:Standard_B1ms。

默认值: Standard_B1ms
--standby-zone

启用高可用性时备用服务器的可用性区域信息。

--storage-auto-grow

启用或禁用存储的自动增长。 默认值为“已启用”。

接受的值: Disabled, Enabled
默认值: Enabled
--storage-size

服务器的存储容量。 最小值为 32 GiB,最大值为 16 TiB。

默认值: 32
--subnet

新的或现有的子网的名称或资源 ID。 仅当创建具有专用访问权限的跨区域副本 (replica)服务器时,此参数才适用。 对于具有专用访问的区域内读取副本 (replica),将传递源服务器设置,并忽略此参数。 如果要使用不同资源组或订阅中的子网,请提供资源 ID 而不是名称。 请注意,子网将委托给 flexibleServer。 进行委托后,此子网不能用于任何其他类型的 Azure 资源。

--subnet-prefixes

以 CIDR 格式创建新子网时要使用的子网 IP 地址前缀。 默认值为 10.0.0.0/24。

--tags

空格分隔标记:key[=value] [key[=value] ...]。使用“”清除现有标记。

--tier

服务器的计算层。 接受的值:可突发、GeneralPurpose、MemoryOptimized。

默认值: Burstable
--version

服务器主版本。

默认值: 5.7
--vnet

新的或现有的虚拟网络的名称或 ID。 仅当创建具有专用访问权限的跨区域副本 (replica)服务器时,此参数才适用。 对于具有专用访问的区域内读取副本 (replica),将传递源服务器设置,并忽略此参数。 如果要使用不同资源组或订阅中的 vnet,请提供资源 ID。 名称必须包含 2 到 64 个字符。 名称必须以字母或数字开头,以字母、数字或下划线结尾,并且只能包含字母、数字、下划线、句点或连字符。

--yes -y

不提示确认。

默认值: False
--zone -z

要在其中预配资源的可用性区域。

全局参数
--debug

提高日志记录详细程度以显示所有调试日志。

--help -h

显示此帮助消息并退出。

--only-show-errors

只显示错误,取消显示警告。

--output -o

输出格式。

接受的值: json, jsonc, none, table, tsv, yaml, yamlc
默认值: json
--query

JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/

--subscription

订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID 配置默认订阅。

--verbose

提高日志记录详细程度。 使用 --debug 获取完整的调试日志。

az mysql flexible-server delete

删除灵活服务器。

az mysql flexible-server delete [--ids]
                                [--name]
                                [--resource-group]
                                [--subscription]
                                [--yes]

示例

删除灵活服务器。

az mysql flexible-server delete --resource-group testGroup --name testserver

在不出现确认提示的情况下删除灵活服务器。

az mysql flexible-server delete --resource-group testGroup --name testserver --yes

可选参数

--ids

一个或多个资源 ID(以空格分隔)。 它应该是包含“Resource Id”参数的所有信息的完整资源 ID。 应提供 --ids 或其他“Resource Id”参数。

--name -n

服务器的名称。 名称只能包含小写字母、数字和连字符 (-)。 最少 3 个字符,最多 63 个字符。

--resource-group -g

资源组的名称。 可以使用 az configure --defaults group=<name> 配置默认组。

--subscription

订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID 配置默认订阅。

--yes -y

不提示确认。

全局参数
--debug

提高日志记录详细程度以显示所有调试日志。

--help -h

显示此帮助消息并退出。

--only-show-errors

只显示错误,取消显示警告。

--output -o

输出格式。

接受的值: json, jsonc, none, table, tsv, yaml, yamlc
默认值: json
--query

JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/

--subscription

订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID 配置默认订阅。

--verbose

提高日志记录详细程度。 使用 --debug 获取完整的调试日志。

az mysql flexible-server execute

连接灵活服务器。

az mysql flexible-server execute --admin-password
                                 --admin-user
                                 --name
                                 [--database-name]
                                 [--file-path]
                                 [--querytext]

必需参数

--admin-password -p

管理员的登录密码。

--admin-user -u

管理员的登录用户名。

--name -n

服务器的名称。 名称只能包含小写字母、数字和连字符 (-)。 最少 3 个字符,最多 63 个字符。

可选参数

--database-name -d

数据库的名称。

--file-path -f

要执行的 sql 文件的路径。

--querytext -q

要针对灵活服务器运行的查询。

全局参数
--debug

提高日志记录详细程度以显示所有调试日志。

--help -h

显示此帮助消息并退出。

--only-show-errors

只显示错误,取消显示警告。

--output -o

输出格式。

接受的值: json, jsonc, none, table, tsv, yaml, yamlc
默认值: json
--query

JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/

--subscription

订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID 配置默认订阅。

--verbose

提高日志记录详细程度。 使用 --debug 获取完整的调试日志。

az mysql flexible-server geo-restore

从备份中异地还原灵活服务器。

az mysql flexible-server geo-restore --location
                                     --source-server
                                     [--address-prefixes]
                                     [--backup-retention]
                                     [--geo-redundant-backup {Disabled, Enabled}]
                                     [--ids]
                                     [--name]
                                     [--no-wait]
                                     [--private-dns-zone]
                                     [--public-access {Disabled, Enabled}]
                                     [--resource-group]
                                     [--sku-name]
                                     [--storage-auto-grow {Disabled, Enabled}]
                                     [--storage-size]
                                     [--subnet]
                                     [--subnet-prefixes]
                                     [--subscription]
                                     [--tags]
                                     [--tier]
                                     [--vnet]
                                     [--yes]
                                     [--zone]

示例

将“testerver”异地还原到具有相同网络配置的“newLocation”位置的新服务器“testserverNew”。 专用访问服务器将使用不同的专用 DNS 区域。

az mysql flexible-server geo-restore --resource-group testGroup --name testserverNew --source-server testserver --location newLocation

将公共访问或专用访问服务器“testerver”异地还原为具有新子网的新服务器“testserverNew”。 将为还原的服务器预配新的 vnet、子网和专用 DNS 区域。 有关更多专用访问方案,请参阅“灵活服务器创建”命令。

az mysql flexible-server geo-restore --resource-group testGroup --name testserverNew \
  --source-server testserver --vnet newVnet --subnet newSubnet \
  --address-prefixes 172.0.0.0/16 --subnet-prefixes 172.0.0.0/24 \
  --private-dns-zone testDNS.mysql.database.azure.com --location newLocation

将专用访问服务器“testerver”异地还原为具有公共访问权限的新服务器“testserverNew”。

az mysql flexible-server geo-restore --resource-group testGroup --name testserverNew  --source-server testserver --public-access Enabled --location newLocation

必需参数

--location -l

位置。 az account list-locations 中的值。 可以使用 az configure --defaults location=<location> 配置默认位置。

--source-server

要从中还原的源服务器的名称或资源 ID。

可选参数

--address-prefixes

以 CIDR 格式创建新虚拟网络时要使用的 IP 地址前缀。 默认值为 10.0.0.0/16。

--backup-retention

备份保留的天数。 范围为 1 到 35 天。 默认值为 7 天。

--geo-redundant-backup

是否启用异地冗余备份。

接受的值: Disabled, Enabled
--ids

一个或多个资源 ID(以空格分隔)。 它应该是包含“Resource Id”参数的所有信息的完整资源 ID。 应提供 --ids 或其他“Resource Id”参数。

--name -n

服务器的名称。 名称只能包含小写字母、数字和连字符 (-)。 最少 3 个字符,最多 63 个字符。

--no-wait

不等待长时间运行的操作完成。

默认值: False
--private-dns-zone

仅当创建具有专用访问权限的跨区域副本 (replica)服务器时,此参数才适用。 对于具有专用访问的区域内读取副本 (replica),将传递源服务器设置,并忽略此参数。 新的或现有的专用 DNS 区域的名称或 ID。 可以使用同一资源组、不同资源组或不同订阅中的专用 DNS 区域。 如果要使用不同资源组或订阅中的区域,请提供资源 ID。如果用户未提供专用 DNS 区域,CLI 会在虚拟网络所在的资源组中创建一个新的。

--public-access

确定公共访问。

接受的值: Disabled, Enabled
--resource-group -g

资源组的名称。 可以使用 az configure --defaults group=<name> 配置默认组。

--sku-name

计算 SKU 的名称。 遵循Standard_{VM 名称}的约定。 示例:Standard_B1ms。

--storage-auto-grow

启用或禁用存储的自动增长。 默认值为“已启用”。

接受的值: Disabled, Enabled
--storage-size

服务器的存储容量。 最小值为 32 GiB,最大值为 16 TiB。

--subnet

新的或现有的子网的名称或资源 ID。 仅当创建具有专用访问权限的跨区域副本 (replica)服务器时,此参数才适用。 对于具有专用访问的区域内读取副本 (replica),将传递源服务器设置,并忽略此参数。 如果要使用不同资源组或订阅中的子网,请提供资源 ID 而不是名称。 请注意,子网将委托给 flexibleServer。 进行委托后,此子网不能用于任何其他类型的 Azure 资源。

--subnet-prefixes

以 CIDR 格式创建新子网时要使用的子网 IP 地址前缀。 默认值为 10.0.0.0/24。

--subscription

订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID 配置默认订阅。

--tags

空格分隔标记:key[=value] [key[=value] ...]。使用“”清除现有标记。

--tier

服务器的计算层。 接受的值:可突发、GeneralPurpose、MemoryOptimized。

--vnet

新的或现有的虚拟网络的名称或 ID。 仅当创建具有专用访问权限的跨区域副本 (replica)服务器时,此参数才适用。 对于具有专用访问的区域内读取副本 (replica),将传递源服务器设置,并忽略此参数。 如果要使用不同资源组或订阅中的 vnet,请提供资源 ID。 名称必须包含 2 到 64 个字符。 名称必须以字母或数字开头,以字母、数字或下划线结尾,并且只能包含字母、数字、下划线、句点或连字符。

--yes -y

不提示确认。

默认值: False
--zone -z

要在其中预配资源的可用性区域。

全局参数
--debug

提高日志记录详细程度以显示所有调试日志。

--help -h

显示此帮助消息并退出。

--only-show-errors

只显示错误,取消显示警告。

--output -o

输出格式。

接受的值: json, jsonc, none, table, tsv, yaml, yamlc
默认值: json
--query

JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/

--subscription

订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID 配置默认订阅。

--verbose

提高日志记录详细程度。 使用 --debug 获取完整的调试日志。

az mysql flexible-server list

列出可用的灵活服务器。

az mysql flexible-server list [--resource-group]

示例

列出订阅中的所有 MySQL 灵活服务器。

az mysql flexible-server list

列出资源组中的所有 MySQL 灵活服务器。

az mysql flexible-server list --resource-group testGroup

以表格式列出资源组中的所有 MySQL 灵活服务器。

az mysql flexible-server list --resource-group testGroup --output table

可选参数

--resource-group -g

资源组的名称。 可以使用 az configure --defaults group=<name> 配置默认组。

全局参数
--debug

提高日志记录详细程度以显示所有调试日志。

--help -h

显示此帮助消息并退出。

--only-show-errors

只显示错误,取消显示警告。

--output -o

输出格式。

接受的值: json, jsonc, none, table, tsv, yaml, yamlc
默认值: json
--query

JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/

--subscription

订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID 配置默认订阅。

--verbose

提高日志记录详细程度。 使用 --debug 获取完整的调试日志。

az mysql flexible-server list-skus

列出给定区域中的可用 SKU。

az mysql flexible-server list-skus --location

示例

列出给定区域中的可用 SKU。

az mysql flexible-server list-skus -l eastus

列出表输出中给定区域中的可用 SKU

az mysql flexible-server list-skus -l eastus -o table

必需参数

--location -l

位置。 az account list-locations 中的值。 可以使用 az configure --defaults location=<location> 配置默认位置。

全局参数
--debug

提高日志记录详细程度以显示所有调试日志。

--help -h

显示此帮助消息并退出。

--only-show-errors

只显示错误,取消显示警告。

--output -o

输出格式。

接受的值: json, jsonc, none, table, tsv, yaml, yamlc
默认值: json
--query

JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/

--subscription

订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID 配置默认订阅。

--verbose

提高日志记录详细程度。 使用 --debug 获取完整的调试日志。

az mysql flexible-server restart

重启灵活服务器。

az mysql flexible-server restart [--failover]
                                 [--ids]
                                 [--name]
                                 [--resource-group]
                                 [--subscription]

示例

重启灵活服务器。

az mysql flexible-server restart --resource-group testGroup --name testserver

使用故障转移重启灵活服务器

az mysql flexible-server restart --resource-group testGroup --name testserver --failover Forced

可选参数

--failover

服务器重启操作的强制故障转移。 允许的值:强制。

--ids

一个或多个资源 ID(以空格分隔)。 它应该是包含“Resource Id”参数的所有信息的完整资源 ID。 应提供 --ids 或其他“Resource Id”参数。

--name -n

服务器的名称。 名称只能包含小写字母、数字和连字符 (-)。 最少 3 个字符,最多 63 个字符。

--resource-group -g

资源组的名称。 可以使用 az configure --defaults group=<name> 配置默认组。

--subscription

订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID 配置默认订阅。

全局参数
--debug

提高日志记录详细程度以显示所有调试日志。

--help -h

显示此帮助消息并退出。

--only-show-errors

只显示错误,取消显示警告。

--output -o

输出格式。

接受的值: json, jsonc, none, table, tsv, yaml, yamlc
默认值: json
--query

JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/

--subscription

订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID 配置默认订阅。

--verbose

提高日志记录详细程度。 使用 --debug 获取完整的调试日志。

az mysql flexible-server restore

从备份还原灵活服务器。

az mysql flexible-server restore --source-server
                                 [--address-prefixes]
                                 [--backup-retention]
                                 [--geo-redundant-backup {Disabled, Enabled}]
                                 [--ids]
                                 [--name]
                                 [--no-wait]
                                 [--private-dns-zone]
                                 [--public-access {Disabled, Enabled}]
                                 [--resource-group]
                                 [--restore-time]
                                 [--sku-name]
                                 [--storage-auto-grow {Disabled, Enabled}]
                                 [--storage-size]
                                 [--subnet]
                                 [--subnet-prefixes]
                                 [--subscription]
                                 [--tags]
                                 [--tier]
                                 [--vnet]
                                 [--yes]
                                 [--zone]

示例

将“testerver”还原到具有相同网络配置的新服务器“testserverNew”的特定时间点。

az mysql flexible-server restore --resource-group testGroup --name testserverNew --source-server testserver --restore-time "2017-06-15T13:10:00Z"

将公共访问或专用访问服务器“testserver”还原为具有新子网的新服务器“testserverNew”到当前时间点。 将为还原的服务器预配新的 vnet、子网和专用 DNS 区域。 有关更多专用访问方案,请参阅“灵活服务器创建”命令。

az mysql flexible-server restore --resource-group testGroup --name testserverNew \
  --source-server testserver --vnet newVnet --subnet newSubnet \
  --address-prefixes 172.0.0.0/16 --subnet-prefixes 172.0.0.0/24 \
  --private-dns-zone testDNS.mysql.database.azure.com

将专用访问服务器“testerver”还原到当前时间点,作为具有公共访问权限的新服务器“testserverNew”。

az mysql flexible-server restore --resource-group testGroup --name testserverNew \
  --source-server testserver --public-access Enabled

必需参数

--source-server

要从中还原的源服务器的名称或资源 ID。

可选参数

--address-prefixes

以 CIDR 格式创建新虚拟网络时要使用的 IP 地址前缀。 默认值为 10.0.0.0/16。

--backup-retention

备份保留的天数。 范围为 1 到 35 天。 默认值为 7 天。

--geo-redundant-backup

是否启用异地冗余备份。

接受的值: Disabled, Enabled
--ids

一个或多个资源 ID(以空格分隔)。 它应该是包含“Resource Id”参数的所有信息的完整资源 ID。 应提供 --ids 或其他“Resource Id”参数。

--name -n

服务器的名称。 名称只能包含小写字母、数字和连字符 (-)。 最少 3 个字符,最多 63 个字符。

--no-wait

不等待长时间运行的操作完成。

默认值: False
--private-dns-zone

仅当创建具有专用访问权限的跨区域副本 (replica)服务器时,此参数才适用。 对于具有专用访问的区域内读取副本 (replica),将传递源服务器设置,并忽略此参数。 新的或现有的专用 DNS 区域的名称或 ID。 可以使用同一资源组、不同资源组或不同订阅中的专用 DNS 区域。 如果要使用不同资源组或订阅中的区域,请提供资源 ID。如果用户未提供专用 DNS 区域,CLI 会在虚拟网络所在的资源组中创建一个新的。

--public-access

确定公共访问。

接受的值: Disabled, Enabled
--resource-group -g

资源组的名称。 可以使用 az configure --defaults group=<name> 配置默认组。

--restore-time

要从 UTC 还原的时间点(ISO8601格式),例如 2017-04-26T02:10:00+00:00 默认值设置为当前时间。

默认值: 2024-05-09T03:39:57+00:00
--sku-name

计算 SKU 的名称。 遵循Standard_{VM 名称}的约定。 示例:Standard_B1ms。

--storage-auto-grow

启用或禁用存储的自动增长。 默认值为“已启用”。

接受的值: Disabled, Enabled
--storage-size

服务器的存储容量。 最小值为 32 GiB,最大值为 16 TiB。

--subnet

新的或现有的子网的名称或资源 ID。 仅当创建具有专用访问权限的跨区域副本 (replica)服务器时,此参数才适用。 对于具有专用访问的区域内读取副本 (replica),将传递源服务器设置,并忽略此参数。 如果要使用不同资源组或订阅中的子网,请提供资源 ID 而不是名称。 请注意,子网将委托给 flexibleServer。 进行委托后,此子网不能用于任何其他类型的 Azure 资源。

--subnet-prefixes

以 CIDR 格式创建新子网时要使用的子网 IP 地址前缀。 默认值为 10.0.0.0/24。

--subscription

订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID 配置默认订阅。

--tags

空格分隔标记:key[=value] [key[=value] ...]。使用“”清除现有标记。

--tier

服务器的计算层。 接受的值:可突发、GeneralPurpose、MemoryOptimized。

--vnet

新的或现有的虚拟网络的名称或 ID。 仅当创建具有专用访问权限的跨区域副本 (replica)服务器时,此参数才适用。 对于具有专用访问的区域内读取副本 (replica),将传递源服务器设置,并忽略此参数。 如果要使用不同资源组或订阅中的 vnet,请提供资源 ID。 名称必须包含 2 到 64 个字符。 名称必须以字母或数字开头,以字母、数字或下划线结尾,并且只能包含字母、数字、下划线、句点或连字符。

--yes -y

不提示确认。

默认值: False
--zone -z

要在其中预配资源的可用性区域。

全局参数
--debug

提高日志记录详细程度以显示所有调试日志。

--help -h

显示此帮助消息并退出。

--only-show-errors

只显示错误,取消显示警告。

--output -o

输出格式。

接受的值: json, jsonc, none, table, tsv, yaml, yamlc
默认值: json
--query

JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/

--subscription

订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID 配置默认订阅。

--verbose

提高日志记录详细程度。 使用 --debug 获取完整的调试日志。

az mysql flexible-server show

获取灵活服务器的详细信息。

az mysql flexible-server show [--ids]
                              [--name]
                              [--resource-group]
                              [--subscription]

示例

获取灵活服务器的详细信息

az mysql flexible-server show --resource-group testGroup --name testserver

可选参数

--ids

一个或多个资源 ID(以空格分隔)。 它应该是包含“Resource Id”参数的所有信息的完整资源 ID。 应提供 --ids 或其他“Resource Id”参数。

--name -n

服务器的名称。 名称只能包含小写字母、数字和连字符 (-)。 最少 3 个字符,最多 63 个字符。

--resource-group -g

资源组的名称。 可以使用 az configure --defaults group=<name> 配置默认组。

--subscription

订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID 配置默认订阅。

全局参数
--debug

提高日志记录详细程度以显示所有调试日志。

--help -h

显示此帮助消息并退出。

--only-show-errors

只显示错误,取消显示警告。

--output -o

输出格式。

接受的值: json, jsonc, none, table, tsv, yaml, yamlc
默认值: json
--query

JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/

--subscription

订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID 配置默认订阅。

--verbose

提高日志记录详细程度。 使用 --debug 获取完整的调试日志。

az mysql flexible-server show-connection-string

显示 MySQL 灵活服务器数据库的连接字符串。

az mysql flexible-server show-connection-string [--admin-password]
                                                [--admin-user]
                                                [--database-name]
                                                [--ids]
                                                [--server-name]
                                                [--subscription]

示例

显示 cmd 和编程语言的连接字符串。

az mysql flexible-server show-connection-string -s testserver -u username -p password -d databasename

可选参数

--admin-password -p

管理员的密码。 最少 8 个字符,最多 128 个字符。 密码必须包含以下类别中的三个类别的字符:英文大写字母、英文小写字母、数字和非字母数字字符。

默认值: {password}
--admin-user -u

服务器管理员istrator 用户名。 设置后,无法更改它。

默认值: {login}
--database-name -d

预配数据库服务器时要创建的数据库的名称。

默认值: {database}
--ids

一个或多个资源 ID(以空格分隔)。 它应该是包含“Resource Id”参数的所有信息的完整资源 ID。 应提供 --ids 或其他“Resource Id”参数。

--server-name -s

服务器的名称。 名称只能包含小写字母、数字和连字符 (-)。 最少 3 个字符,最多 63 个字符。

默认值: {server}
--subscription

订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID 配置默认订阅。

全局参数
--debug

提高日志记录详细程度以显示所有调试日志。

--help -h

显示此帮助消息并退出。

--only-show-errors

只显示错误,取消显示警告。

--output -o

输出格式。

接受的值: json, jsonc, none, table, tsv, yaml, yamlc
默认值: json
--query

JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/

--subscription

订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID 配置默认订阅。

--verbose

提高日志记录详细程度。 使用 --debug 获取完整的调试日志。

az mysql flexible-server start

启动灵活服务器。

az mysql flexible-server start [--ids]
                               [--name]
                               [--no-wait]
                               [--resource-group]
                               [--subscription]

示例

启动灵活服务器。

az mysql flexible-server start --resource-group testGroup --name testserver

可选参数

--ids

一个或多个资源 ID(以空格分隔)。 它应该是包含“Resource Id”参数的所有信息的完整资源 ID。 应提供 --ids 或其他“Resource Id”参数。

--name -n

服务器的名称。 名称只能包含小写字母、数字和连字符 (-)。 最少 3 个字符,最多 63 个字符。

--no-wait

不等待长时间运行的操作完成。

默认值: False
--resource-group -g

资源组的名称。 可以使用 az configure --defaults group=<name> 配置默认组。

--subscription

订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID 配置默认订阅。

全局参数
--debug

提高日志记录详细程度以显示所有调试日志。

--help -h

显示此帮助消息并退出。

--only-show-errors

只显示错误,取消显示警告。

--output -o

输出格式。

接受的值: json, jsonc, none, table, tsv, yaml, yamlc
默认值: json
--query

JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/

--subscription

订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID 配置默认订阅。

--verbose

提高日志记录详细程度。 使用 --debug 获取完整的调试日志。

az mysql flexible-server stop

停止灵活服务器。

az mysql flexible-server stop [--ids]
                              [--name]
                              [--no-wait]
                              [--resource-group]
                              [--subscription]

示例

停止灵活服务器。

az mysql flexible-server stop --resource-group testGroup --name testserver

可选参数

--ids

一个或多个资源 ID(以空格分隔)。 它应该是包含“Resource Id”参数的所有信息的完整资源 ID。 应提供 --ids 或其他“Resource Id”参数。

--name -n

服务器的名称。 名称只能包含小写字母、数字和连字符 (-)。 最少 3 个字符,最多 63 个字符。

--no-wait

不等待长时间运行的操作完成。

默认值: False
--resource-group -g

资源组的名称。 可以使用 az configure --defaults group=<name> 配置默认组。

--subscription

订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID 配置默认订阅。

全局参数
--debug

提高日志记录详细程度以显示所有调试日志。

--help -h

显示此帮助消息并退出。

--only-show-errors

只显示错误,取消显示警告。

--output -o

输出格式。

接受的值: json, jsonc, none, table, tsv, yaml, yamlc
默认值: json
--query

JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/

--subscription

订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID 配置默认订阅。

--verbose

提高日志记录详细程度。 使用 --debug 获取完整的调试日志。

az mysql flexible-server update

更新灵活服务器。

az mysql flexible-server update [--add]
                                [--admin-password]
                                [--auto-scale-iops {Disabled, Enabled}]
                                [--backup-identity]
                                [--backup-key]
                                [--backup-retention]
                                [--disable-data-encryption {false, true}]
                                [--force-string]
                                [--geo-redundant-backup {Disabled, Enabled}]
                                [--high-availability {Disabled, SameZone, ZoneRedundant}]
                                [--identity]
                                [--ids]
                                [--iops]
                                [--key]
                                [--maintenance-window]
                                [--name]
                                [--public-access {Disabled, Enabled}]
                                [--remove]
                                [--replication-role]
                                [--resource-group]
                                [--set]
                                [--sku-name]
                                [--standby-zone]
                                [--storage-auto-grow {Disabled, Enabled}]
                                [--storage-size]
                                [--subscription]
                                [--tags]
                                [--tier]

示例

使用服务器和资源组的本地上下文更新灵活服务器的 SKU。

az mysql flexible-server update --sku-name Standard_D4ds_v4 --tier GeneralPurpose

更新灵活服务器的标记。

az mysql flexible-server update --resource-group testGroup --name testserver --tags "k1=v1" "k2=v2"

设置或更改数据加密的密钥和标识。

# get key identifier of the existing key
newKeyIdentifier=$(az keyvault key show --vault-name testVault --name testKey \
  --query key.kid -o tsv)


# update server with new key/identity
az mysql flexible-server update --resource-group testGroup --name testserver \
  --key $newKeyIdentifier --identity newIdentity

使用异地冗余备份设置或更改用于数据加密的密钥、标识、备份密钥和备份标识。

# get key identifier of the existing key and backup key
newKeyIdentifier=$(az keyvault key show --vault-name testVault --name testKey \
  --query key.kid -o tsv)

newBackupKeyIdentifier=$(az keyvault key show --vault-name testBackupVault \
  --name testBackupKey --query key.kid -o tsv)


# update server with new key/identity and backup key/identity
az mysql flexible-server update --resource-group testGroup --name testserver \
  --key $newKeyIdentifier --identity newIdentity \
  --backup-key $newBackupKeyIdentifier --backup-identity newBackupIdentity

禁用灵活服务器的数据加密。

az mysql flexible-server update --resource-group testGroup --name testserver \
  --disable-data-encryption

可选参数

--add

通过指定路径和键值对将对象添加到对象列表。 示例:--add property.listProperty <key=value, string or JSON string>

默认值: []
--admin-password -p

管理员的密码。 最少 8 个字符,最多 128 个字符。 密码必须包含以下类别中的三个类别的字符:英文大写字母、英文小写字母、数字和非字母数字字符。

--auto-scale-iops

启用或禁用自动缩放 iops。 默认值为 Disabled。

接受的值: Disabled, Enabled
--backup-identity

用于数据加密的异地备份用户标识的名称或资源 ID。 标识需要与备份区域位于同一区域。

--backup-key

用于数据加密的异地备份 keyvault 密钥的资源 ID。 密钥需要与备份区域位于同一区域。

--backup-retention

备份保留的天数。 范围为 1 到 35 天。 默认值为 7 天。

--disable-data-encryption

通过删除密钥禁用数据加密。

接受的值: false, true
默认值: False
--force-string

使用“set”或“add”时,保留字符串文本,而不是尝试转换为 JSON。

默认值: False
--geo-redundant-backup

是否启用异地冗余备份。

接受的值: Disabled, Enabled
--high-availability

启用(ZoneRedundant 或 SameZone)或禁用高可用性功能。

接受的值: Disabled, SameZone, ZoneRedundant
--identity

用于数据加密的用户分配的标识的名称或资源 ID。

--ids

一个或多个资源 ID(以空格分隔)。 它应该是包含“Resource Id”参数的所有信息的完整资源 ID。 应提供 --ids 或其他“Resource Id”参数。

--iops

为此服务器分配的 IOPS 数。 你将根据预配的计算和存储获得一定数量的免费 IOPS。 IOPS 的默认值为“空闲 IOPS”。 若要详细了解基于计算和存储的 IOPS,请参阅“Azure Database for MySQL 灵活服务器中的 IOPS”。

--key

用于数据加密的主密钥库密钥的资源 ID。

--maintenance-window

为维护指定的时间段(UTC)。 示例:“Sun:23:30”计划于星期天晚上 11:30 UTC。 若要重新设置为默认传入“Disabled”。

--name -n

服务器的名称。 名称只能包含小写字母、数字和连字符 (-)。 最少 3 个字符,最多 63 个字符。

--public-access

启用或禁用服务器上的公共访问。

接受的值: Disabled, Enabled
--remove

从列表中删除属性或元素。 示例: --remove property.list <indexToRemove> OR --remove propertyToRemove.

默认值: []
--replication-role

服务器的副本 (replica)角色。

--resource-group -g

资源组的名称。 可以使用 az configure --defaults group=<name> 配置默认组。

--set

通过指定要设置的属性路径和值来更新对象。 示例:--set property1.property2=<value>

默认值: []
--sku-name

计算 SKU 的名称。 遵循Standard_{VM 名称}的约定。 示例:Standard_B1ms。

--standby-zone

启用高可用性时备用服务器的可用性区域信息。

--storage-auto-grow

启用或禁用存储的自动增长。 默认值为“已启用”。

接受的值: Disabled, Enabled
--storage-size

服务器的存储容量。 最小值为 32 GiB,最大值为 16 TiB。

--subscription

订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID 配置默认订阅。

--tags

空格分隔标记:key[=value] [key[=value] ...]。使用“”清除现有标记。

--tier

服务器的计算层。 接受的值:可突发、GeneralPurpose、MemoryOptimized。

全局参数
--debug

提高日志记录详细程度以显示所有调试日志。

--help -h

显示此帮助消息并退出。

--only-show-errors

只显示错误,取消显示警告。

--output -o

输出格式。

接受的值: json, jsonc, none, table, tsv, yaml, yamlc
默认值: json
--query

JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/

--subscription

订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID 配置默认订阅。

--verbose

提高日志记录详细程度。 使用 --debug 获取完整的调试日志。

az mysql flexible-server upgrade

升级灵活服务器的主版本。

az mysql flexible-server upgrade --version {8}
                                 [--ids]
                                 [--name]
                                 [--resource-group]
                                 [--subscription]
                                 [--yes]

示例

将服务器“testsvr”升级到 MySQL 主版本 8。

# make sure that sql_mode only contains values allowed in new version, for example:
az mysql flexible-server parameter set -g testgroup -s testsvr -n sql_mode \
  -v "ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO"

# upgrade server to MySQL major version 8.
az mysql flexible-server upgrade -g testgroup -n testsvr -v 8

必需参数

--version -v

服务器主版本。

接受的值: 8

可选参数

--ids

一个或多个资源 ID(以空格分隔)。 它应该是包含“Resource Id”参数的所有信息的完整资源 ID。 应提供 --ids 或其他“Resource Id”参数。

--name -n

服务器的名称。 名称只能包含小写字母、数字和连字符 (-)。 最少 3 个字符,最多 63 个字符。

--resource-group -g

资源组的名称。 可以使用 az configure --defaults group=<name> 配置默认组。

--subscription

订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID 配置默认订阅。

--yes -y

不提示确认。

全局参数
--debug

提高日志记录详细程度以显示所有调试日志。

--help -h

显示此帮助消息并退出。

--only-show-errors

只显示错误,取消显示警告。

--output -o

输出格式。

接受的值: json, jsonc, none, table, tsv, yaml, yamlc
默认值: json
--query

JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/

--subscription

订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID 配置默认订阅。

--verbose

提高日志记录详细程度。 使用 --debug 获取完整的调试日志。

az mysql flexible-server wait

等待灵活服务器满足某些条件。

az mysql flexible-server wait [--created]
                              [--custom]
                              [--deleted]
                              [--exists]
                              [--ids]
                              [--interval]
                              [--name]
                              [--resource-group]
                              [--subscription]
                              [--timeout]
                              [--updated]

示例

等待灵活服务器满足某些条件。

az mysql flexible-server wait --exists --resource-group testGroup --name testserver

可选参数

--created

等待在“Succeeded”中使用“provisioningState”创建。

默认值: False
--custom

等待条件满足自定义 JMESPath 查询。 例如 provisioningState!='InProgress', instanceView.statuses[?code=='PowerState/running']。

--deleted

等到删除为止。

默认值: False
--exists

等待资源存在。

默认值: False
--ids

一个或多个资源 ID(以空格分隔)。 它应该是包含“Resource Id”参数的所有信息的完整资源 ID。 应提供 --ids 或其他“Resource Id”参数。

--interval

轮询间隔(以秒为单位)。

默认值: 30
--name -n

服务器的名称。 名称只能包含小写字母、数字和连字符 (-)。 最少 3 个字符,最多 63 个字符。

--resource-group -g

资源组的名称。 可以使用 az configure --defaults group=<name> 配置默认组。

--subscription

订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID 配置默认订阅。

--timeout

最大等待(以秒为单位)。

默认值: 3600
--updated

等到 provisioningState 更新为“Succeeded”。

默认值: False
全局参数
--debug

提高日志记录详细程度以显示所有调试日志。

--help -h

显示此帮助消息并退出。

--only-show-errors

只显示错误,取消显示警告。

--output -o

输出格式。

接受的值: json, jsonc, none, table, tsv, yaml, yamlc
默认值: json
--query

JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/

--subscription

订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID 配置默认订阅。

--verbose

提高日志记录详细程度。 使用 --debug 获取完整的调试日志。