你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn。
az mysql flexible-server
管理Azure Database for MySQL灵活服务器。
命令
az mysql flexible-server connect
Connect to a flexible server.
az mysql flexible-server connect --admin-user
--name
[--admin-password]
[--database-name]
[--interactive]
[--querytext]
必需参数
管理员的登录用户名。
服务器的名称。 名称只能包含小写字母、数字和连字符 () 字符。 最少 3 个字符,最多 63 个字符。
可选参数
管理员的登录密码。
数据库的名称。
传递此参数以在交互模式下连接到数据库。
要针对灵活服务器运行的查询。
提高日志记录详细程度以显示所有调试日志。
显示此帮助消息并退出。
只显示错误,取消显示警告。
输出格式。
JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/。
订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID
配置默认订阅。
提高日志记录详细程度。 使用 --debug 获取完整的调试日志。
az mysql flexible-server create
创建 MySQL 灵活服务器。
Create a MySQL flexible server with custom or default configuration. For more information for network configuration, see
- Configure public access https://docs.microsoft.com/en-us/azure/mysql/flexible-server/how-to-manage-firewall-cli
- Configure private access https://docs.microsoft.com/en-us/azure/mysql/flexible-server/how-to-manage-virtual-network-cli.
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, Enabled, 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
可选参数
以 CIDR 格式创建新虚拟网络时要使用的 IP 地址前缀。 默认值为 10.0.0.0/16。
管理员的密码。 最少 8 个字符,最多 128 个字符。 密码必须包含以下类别中的三个类别的字符:英文大写字母、英文小写字母、数字和非字母数字字符。
服务器的管理员用户名。 设置后,无法更改它。
启用或禁用自动缩放 iops。 默认值为 Disabled。
用于数据加密的异地备份用户标识的名称或资源 ID。 标识需要与备份区域位于同一区域。
用于数据加密的异地备份密钥的资源 ID。 密钥需要与备份区域位于同一区域。
备份的保留天数。 范围为 1 到 35 天。 默认值为 7 天。
预配数据库服务器时要创建的数据库的名称。
是否启用异地冗余备份。
启用 (ZoneRedundant 或 SameZone) 或禁用高可用性功能。
用于数据加密的用户分配标识的名称或资源 ID。
要为此服务器分配的 IOPS 数。 根据预配的计算和存储,将获得一定数量的可用 IOPS。 IOPS 的默认值为可用 IOPS。 若要详细了解基于计算和存储的 IOPS,请参阅 Azure Database for MySQL 灵活服务器中的 IOPS。
用于数据加密的主密钥vault 密钥的资源 ID。
位置。 az account list-locations
中的值。 可以使用 az configure --defaults location=<location>
配置默认位置。
服务器的名称。 名称只能包含小写字母、数字和连字符 () 字符。 最少 3 个字符,最多 63 个字符。
此参数仅适用于具有专用访问权限的服务器。 新的或现有的专用 dns 区域的名称或 ID。 可以使用同一资源组、不同资源组或不同订阅中的专用 DNS 区域。 如果要使用不同的资源组或订阅中的区域,请提供资源 ID。如果用户未提供,CLI 会在虚拟网络所在的资源组中创建一个新的专用 dns 区域。
确定公共访问。 输入要包含在允许的 IP 列表中的单个 IP 地址或 IP 地址范围。 IP 地址范围必须用短划线分隔,并且不包含任何空格。 指定 0.0.0.0 允许从 Azure 中部署的任何资源的公共访问来访问服务器。 将其设置为“无”会将服务器设置为公共访问模式,但不创建防火墙规则。
资源组的名称。 可以使用 az configure --defaults group=<name>
配置默认组。
计算 SKU 的名称。 遵循{VM name} Standard_约定。 示例:Standard_B1ms。
启用高可用性时备用服务器的可用性区域信息。
启用或禁用存储的自动增长。 默认值为 Enabled。
服务器的存储容量。 最小值为 32 GiB,最大值为 16 TiB。
新子网或现有子网的名称或资源 ID。 如果要使用不同资源组或订阅中的子网,请提供资源 ID,而不是名称。 请注意,子网将委派给 flexibleServers。 委派后,此子网不能用于任何其他类型的 Azure 资源。
以 CIDR 格式创建新子网时要使用的子网 IP 地址前缀。 默认值为 10.0.0.0/24。
空格分隔的标记:key[=value] [key[=value] ...]。使用“”清除现有标记。
服务器的计算层。 接受的值:Burstable、GeneralPurpose、Memory Optimized。
服务器主版本。
新虚拟网络或现有虚拟网络的名称或 ID。 如果要使用不同资源组或订阅中的 vnet,请提供资源 ID。 名称必须介于 2 到 64 个字符之间。 名称必须以字母或数字开头,以字母、数字或下划线结尾,并且只能包含字母、数字、下划线、句点或连字符。
不提示确认。
要在其中预配资源的可用性区域。
提高日志记录详细程度以显示所有调试日志。
显示此帮助消息并退出。
只显示错误,取消显示警告。
输出格式。
JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/。
订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID
配置默认订阅。
提高日志记录详细程度。 使用 --debug 获取完整的调试日志。
az mysql flexible-server delete
Delete a flexible server.
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
可选参数
一个或多个资源 ID(以空格分隔)。 它应该是包含“资源 ID”参数的所有信息的完整资源 ID。 应提供 --ids 或其他“资源 ID”参数。
服务器的名称。 The name can contain only lowercase letters, numbers, and the hyphen (-) character. Minimum 3 characters and maximum 63 characters.
资源组的名称。 可以使用 az configure --defaults group=<name>
配置默认组。
订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID
配置默认订阅。
不提示确认。
提高日志记录详细程度以显示所有调试日志。
显示此帮助消息并退出。
只显示错误,取消显示警告。
输出格式。
JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/。
订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID
配置默认订阅。
提高日志记录详细程度。 使用 --debug 获取完整的调试日志。
az mysql flexible-server execute
连接到灵活服务器。
az mysql flexible-server execute --admin-password
--admin-user
--name
[--database-name]
[--file-path]
[--querytext]
必需参数
管理员的登录密码。
管理员的登录用户名。
服务器的名称。 The name can contain only lowercase letters, numbers, and the hyphen (-) character. 最少 3 个字符,最多 63 个字符。
可选参数
数据库的名称。
要执行的 sql 文件的路径。
要针对灵活服务器运行的查询。
提高日志记录详细程度以显示所有调试日志。
显示此帮助消息并退出。
只显示错误,取消显示警告。
输出格式。
JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/。
订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID
配置默认订阅。
提高日志记录详细程度。 使用 --debug 获取完整的调试日志。
az mysql flexible-server geo-restore
从备份异地还原灵活服务器。
az mysql flexible-server geo-restore --location
--source-server
[--address-prefixes]
[--ids]
[--name]
[--no-wait]
[--private-dns-zone]
[--public-access {Disabled, Enabled}]
[--resource-group]
[--subnet]
[--subnet-prefixes]
[--subscription]
[--vnet]
[--yes]
[--zone]
示例
将“testserver”异地还原到位置“newLocation”中具有相同网络配置的新服务器“testerverNew”。 专用访问服务器将使用不同的专用 dns 区域。
az mysql flexible-server geo-restore --resource-group testGroup --name testserverNew --source-server testserver --location newLocation
异地还原公共访问或专用访问服务器“testerver”作为具有新子网的新服务器“testerverNew”。 将为还原的服务器预配新的 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”作为具有公共访问的新服务器“testerverNew”。
az mysql flexible-server geo-restore --resource-group testGroup --name testserverNew --source-server testserver --public-access Enabled --location newLocation
必需参数
位置。 az account list-locations
中的值。 可以使用 az configure --defaults location=<location>
配置默认位置。
要从其还原的源服务器的名称或资源 ID。
可选参数
以 CIDR 格式创建新虚拟网络时要使用的 IP 地址前缀。 默认值为 10.0.0.0/16。
一个或多个资源 ID(以空格分隔)。 它应该是包含“资源 ID”参数的所有信息的完整资源 ID。 应提供 --ids 或其他“资源 ID”参数。
服务器的名称。 名称只能包含小写字母、数字和连字符 () 字符。 Minimum 3 characters and maximum 63 characters.
不等待长时间运行的操作完成。
此参数仅适用于具有专用访问权限的服务器。 新的或现有的专用 dns 区域的名称或 ID。 可以使用同一资源组、不同资源组或不同订阅中的专用 DNS 区域。 如果要使用不同的资源组或订阅中的区域,请提供资源 ID。如果用户未提供,CLI 会在虚拟网络所在的资源组中创建一个新的专用 dns 区域。
确定公共访问。
资源组的名称。 可以使用 az configure --defaults group=<name>
配置默认组。
新子网或现有子网的名称或资源 ID。 如果要使用不同资源组或订阅中的子网,请提供资源 ID,而不是名称。 请注意,子网将委派给 flexibleServers。 委派后,此子网不能用于任何其他类型的 Azure 资源。
以 CIDR 格式创建新子网时要使用的子网 IP 地址前缀。 默认值为 10.0.0.0/24。
订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID
配置默认订阅。
新虚拟网络或现有虚拟网络的名称或 ID。 如果要使用不同资源组或订阅中的 vnet,请提供资源 ID。 名称必须介于 2 到 64 个字符之间。 名称必须以字母或数字开头,以字母、数字或下划线结尾,并且只能包含字母、数字、下划线、句点或连字符。
不提示确认。
要在其中预配资源的可用性区域。
提高日志记录详细程度以显示所有调试日志。
显示此帮助消息并退出。
只显示错误,取消显示警告。
输出格式。
JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/。
订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID
配置默认订阅。
提高日志记录详细程度。 使用 --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
可选参数
资源组的名称。 可以使用 az configure --defaults group=<name>
配置默认组。
提高日志记录详细程度以显示所有调试日志。
显示此帮助消息并退出。
只显示错误,取消显示警告。
输出格式。
JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/。
订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID
配置默认订阅。
提高日志记录详细程度。 使用 --debug 获取完整的调试日志。
az mysql flexible-server list-skus
Lists available sku's in the given region.
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
必需参数
位置。 az account list-locations
中的值。 可以使用 az configure --defaults location=<location>
配置默认位置。
提高日志记录详细程度以显示所有调试日志。
显示此帮助消息并退出。
只显示错误,取消显示警告。
输出格式。
JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/。
订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID
配置默认订阅。
提高日志记录详细程度。 使用 --debug 获取完整的调试日志。
az mysql flexible-server restart
Restart a flexible server.
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
可选参数
服务器重启操作的强制故障转移。 允许的值:强制。
一个或多个资源 ID(以空格分隔)。 It should be a complete resource ID containing all information of 'Resource Id' arguments. You should provide either --ids or other 'Resource Id' arguments.
服务器的名称。 The name can contain only lowercase letters, numbers, and the hyphen (-) character. Minimum 3 characters and maximum 63 characters.
资源组的名称。 可以使用 az configure --defaults group=<name>
配置默认组。
订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID
配置默认订阅。
提高日志记录详细程度以显示所有调试日志。
显示此帮助消息并退出。
只显示错误,取消显示警告。
输出格式。
JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/。
订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID
配置默认订阅。
提高日志记录详细程度。 使用 --debug 获取完整的调试日志。
az mysql flexible-server restore
从备份还原灵活服务器。
az mysql flexible-server restore --source-server
[--address-prefixes]
[--ids]
[--name]
[--no-wait]
[--private-dns-zone]
[--public-access {Disabled, Enabled}]
[--resource-group]
[--restore-time]
[--subnet]
[--subnet-prefixes]
[--subscription]
[--vnet]
[--yes]
[--zone]
示例
将“testserver”还原到特定时间点,作为具有相同网络配置的新服务器“testserverNew”。
az mysql flexible-server restore --resource-group testGroup --name testserverNew --source-server testserver --restore-time "2017-06-15T13:10:00Z"
将公共访问或专用访问服务器“testerver”还原为具有新子网的新服务器“testerverNew”到当前时间点。 New vnet, subnet, and private dns zone for the restored server will be provisioned. Please refer to 'flexible-server create' command for more private access scenarios.
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
必需参数
要从中还原的源服务器的名称或资源 ID。
可选参数
The IP address prefix to use when creating a new virtual network in CIDR format. 默认值为 10.0.0.0/16。
一个或多个资源 ID(以空格分隔)。 It should be a complete resource ID containing all information of 'Resource Id' arguments. You should provide either --ids or other 'Resource Id' arguments.
服务器的名称。 The name can contain only lowercase letters, numbers, and the hyphen (-) character. Minimum 3 characters and maximum 63 characters.
不等待长时间运行的操作完成。
This parameter only applies for a server with private access. The name or id of new or existing private dns zone. You can use the private dns zone from same resource group, different resource group, or different subscription. If you want to use a zone from different resource group or subscription, please provide resource Id. CLI creates a new private dns zone within the same resource group as virtual network if not provided by users.
Determines the public access.
资源组的名称。 可以使用 az configure --defaults group=<name>
配置默认组。
从 (ISO8601 格式还原的 UTC 时间点) ,例如 2017-04-26T02:10:00+00:00 默认值设置为当前时间。
Name or resource ID of a new or existing subnet. If you want to use a subnet from different resource group or subscription, please provide resource ID instead of name. Please note that the subnet will be delegated to flexibleServers. After delegation, this subnet cannot be used for any other type of Azure resources.
The subnet IP address prefix to use when creating a new subnet in CIDR format. 默认值为 10.0.0.0/24。
订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID
配置默认订阅。
新虚拟网络或现有虚拟网络的名称或 ID。 如果要使用来自不同资源组或订阅的 vnet,请提供资源 ID。 名称必须介于 2 到 64 个字符之间。 名称必须以字母或数字开头,以字母、数字或下划线结尾,并且只能包含字母、数字、下划线、句点或连字符。
不提示确认。
要在其中预配资源的可用性区域。
提高日志记录详细程度以显示所有调试日志。
显示此帮助消息并退出。
只显示错误,取消显示警告。
输出格式。
JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/。
订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID
配置默认订阅。
提高日志记录详细程度。 使用 --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
可选参数
一个或多个资源 ID(以空格分隔)。 它应该是包含“资源 ID”参数的所有信息的完整资源 ID。 应提供 --ids 或其他“资源 ID”参数。
服务器的名称。 名称只能包含小写字母、数字和连字符 () 字符。 最少 3 个字符,最多 63 个字符。
资源组的名称。 可以使用 az configure --defaults group=<name>
配置默认组。
订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID
配置默认订阅。
提高日志记录详细程度以显示所有调试日志。
显示此帮助消息并退出。
只显示错误,取消显示警告。
输出格式。
JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/。
订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID
配置默认订阅。
提高日志记录详细程度。 使用 --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
可选参数
管理员的密码。 最少 8 个字符,最多 128 个字符。 密码必须包含以下类别中的三个类别的字符:英文大写字母、英文小写字母、数字和非字母数字字符。
服务器的管理员用户名。 设置后,无法更改。
预配数据库服务器时要创建的数据库的名称。
一个或多个资源 ID(以空格分隔)。 It should be a complete resource ID containing all information of 'Resource Id' arguments. You should provide either --ids or other 'Resource Id' arguments.
服务器的名称。 The name can contain only lowercase letters, numbers, and the hyphen (-) character. Minimum 3 characters and maximum 63 characters.
订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID
配置默认订阅。
提高日志记录详细程度以显示所有调试日志。
显示此帮助消息并退出。
只显示错误,取消显示警告。
输出格式。
JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/。
订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID
配置默认订阅。
提高日志记录详细程度。 使用 --debug 获取完整的调试日志。
az mysql flexible-server start
Start a flexible server.
az mysql flexible-server start [--ids]
[--name]
[--no-wait]
[--resource-group]
[--subscription]
示例
启动灵活服务器。
az mysql flexible-server start --resource-group testGroup --name testserver
可选参数
一个或多个资源 ID(以空格分隔)。 It should be a complete resource ID containing all information of 'Resource Id' arguments. You should provide either --ids or other 'Resource Id' arguments.
服务器的名称。 The name can contain only lowercase letters, numbers, and the hyphen (-) character. Minimum 3 characters and maximum 63 characters.
不等待长时间运行的操作完成。
资源组的名称。 可以使用 az configure --defaults group=<name>
配置默认组。
订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID
配置默认订阅。
提高日志记录详细程度以显示所有调试日志。
显示此帮助消息并退出。
只显示错误,取消显示警告。
输出格式。
JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/。
订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID
配置默认订阅。
提高日志记录详细程度。 使用 --debug 获取完整的调试日志。
az mysql flexible-server stop
Stop a flexible server.
az mysql flexible-server stop [--ids]
[--name]
[--no-wait]
[--resource-group]
[--subscription]
示例
停止灵活服务器。
az mysql flexible-server stop --resource-group testGroup --name testserver
可选参数
一个或多个资源 ID(以空格分隔)。 It should be a complete resource ID containing all information of 'Resource Id' arguments. You should provide either --ids or other 'Resource Id' arguments.
服务器的名称。 The name can contain only lowercase letters, numbers, and the hyphen (-) character. Minimum 3 characters and maximum 63 characters.
不等待长时间运行的操作完成。
资源组的名称。 可以使用 az configure --defaults group=<name>
配置默认组。
订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID
配置默认订阅。
提高日志记录详细程度以显示所有调试日志。
显示此帮助消息并退出。
只显示错误,取消显示警告。
输出格式。
JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/。
订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID
配置默认订阅。
提高日志记录详细程度。 使用 --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, Enabled, SameZone, ZoneRedundant}]
[--identity]
[--ids]
[--iops]
[--key]
[--maintenance-window]
[--name]
[--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 property.listProperty <key=value、string 或 JSON string>。
The password of the administrator. Minimum 8 characters and maximum 128 characters. 密码必须包含以下类别中的三个类别的字符:英文大写字母、英文小写字母、数字和非字母数字字符。
启用或禁用自动缩放 iops。 默认值为 Disabled。
用于数据加密的异地备份用户标识的名称或资源 ID。 标识需要与备份区域位于同一区域。
用于数据加密的异地备份 keyvault 密钥的资源 ID。 密钥需要与备份区域位于同一区域。
保留备份的天数。 范围为 1 到 35 天。 默认值为 7 天。
通过删除密钥 () 来禁用数据加密。
使用“set”或“add”时,请保留字符串文本,而不是尝试转换为 JSON。
是否启用异地冗余备份。
启用 (ZoneRedundant 或 SameZone) 或禁用高可用性功能。
用于数据加密的用户分配标识的名称或资源 ID。
一个或多个资源 ID(以空格分隔)。 It should be a complete resource ID containing all information of 'Resource Id' arguments. You should provide either --ids or other 'Resource Id' arguments.
要为此服务器分配的 IOPS 数。 你将根据预配的计算和存储获得一定数量的可用 IOPS。 IOPS 的默认值为可用 IOPS。 若要详细了解基于计算和存储的 IOPS,请参阅 Azure Database for MySQL 灵活服务器中的 IOPS。
用于数据加密的主密钥保管库密钥的资源 ID。
指定维护的时间段 (UTC) 。 示例:“星期日:23:30”安排在星期日晚上 11:30 UTC。 在“已禁用”中设置回默认传递。
服务器的名称。 The name can contain only lowercase letters, numbers, and the hyphen (-) character. Minimum 3 characters and maximum 63 characters.
从列表中删除属性或元素。 示例:--remove property.list 或 --remove propertyToRemove。
服务器的复制角色。
资源组的名称。 可以使用 az configure --defaults group=<name>
配置默认组。
通过指定要设置的属性路径和值来更新对象。 示例:--set property1.property2=。
计算 SKU 的名称。 遵循{VM name} Standard_约定。 示例:Standard_B1ms。
启用高可用性时备用服务器的可用性区域信息。
启用或禁用存储的自动增长。 默认值为 Enabled。
服务器的存储容量。 最小值为 32 GiB,最大值为 16 TiB。
订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID
配置默认订阅。
空格分隔标记:key[=value] [key[=value] ...]。使用“”清除现有标记。
服务器的计算层。 接受的值:Burstable、GeneralPurpose、Memory Optimized。
提高日志记录详细程度以显示所有调试日志。
显示此帮助消息并退出。
只显示错误,取消显示警告。
输出格式。
JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/。
订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID
配置默认订阅。
提高日志记录详细程度。 使用 --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
必需参数
服务器主版本。
可选参数
一个或多个资源 ID(以空格分隔)。 它应该是包含“资源 ID”参数的所有信息的完整资源 ID。 应提供 --ids 或其他“资源 ID”参数。
服务器的名称。 名称只能包含小写字母、数字和连字符 () 字符。 最少 3 个字符,最多 63 个字符。
资源组的名称。 可以使用 az configure --defaults group=<name>
配置默认组。
订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID
配置默认订阅。
不提示确认。
提高日志记录详细程度以显示所有调试日志。
显示此帮助消息并退出。
只显示错误,取消显示警告。
输出格式。
JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/。
订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID
配置默认订阅。
提高日志记录详细程度。 使用 --debug 获取完整的调试日志。
az mysql flexible-server wait
Wait for the flexible server to satisfy certain conditions.
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
可选参数
等到在“Succeeded”处使用“provisioningState”创建。
等待条件满足自定义 JMESPath 查询。 例如 provisioningState!='InProgress', instanceView.statuses[?code=='PowerState/running']。
等到删除。
等待资源存在。
一个或多个资源 ID(以空格分隔)。 It should be a complete resource ID containing all information of 'Resource Id' arguments. You should provide either --ids or other 'Resource Id' arguments.
轮询间隔(以秒为单位)。
服务器的名称。 The name can contain only lowercase letters, numbers, and the hyphen (-) character. Minimum 3 characters and maximum 63 characters.
资源组的名称。 可以使用 az configure --defaults group=<name>
配置默认组。
订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID
配置默认订阅。
最长等待时间(以秒为单位)。
等待,直到在“Succeeded”处使用 provisioningState 更新。
提高日志记录详细程度以显示所有调试日志。
显示此帮助消息并退出。
只显示错误,取消显示警告。
输出格式。
JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/。
订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID
配置默认订阅。
提高日志记录详细程度。 使用 --debug 获取完整的调试日志。
反馈
提交和查看相关反馈