az mysql server

Manage MySQL servers.

Commands

az mysql server ad-admin

Manage a MySQL server's Active Directory administrator.

az mysql server ad-admin create

Create an Active Directory administrator for MySQL server.

az mysql server ad-admin delete

Delete an Active Directory Administrator for MySQL server.

az mysql server ad-admin list

List all Active Directory Administrators for MySQL server.

az mysql server ad-admin show

Get Active Directory Administrator information for a MySQL server.

az mysql server ad-admin wait

Place the CLI in a waiting state until a condition of the MySQL server Active Directory Administrator is met.

az mysql server configuration

Manage configuration values for a server.

az mysql server configuration list

List the configuration values for a server.

az mysql server configuration set

Update the configuration of a server.

az mysql server configuration show

Get the configuration for a server.".

az mysql server create

Create a server.

az mysql server delete

Delete a server.

az mysql server firewall-rule

Manage firewall rules for a server.

az mysql server firewall-rule create

Create a new firewall rule for a server.

az mysql server firewall-rule delete

Delete a firewall rule.

az mysql server firewall-rule list

List all firewall rules for a server.

az mysql server firewall-rule show

Get the details of a firewall rule.

az mysql server firewall-rule update

Update a firewall rule.

az mysql server georestore

Geo-restore a server from backup.

az mysql server key

Manage MySQL server keys.

az mysql server key create

Create server key.

az mysql server key delete

Delete server key.

az mysql server key list

Gets a list of Server keys.

az mysql server key show

Show server key.

az mysql server list

List available servers.

az mysql server list-skus

List available sku's in the given region.

az mysql server private-endpoint-connection

Manage MySQL server private endpoint connections.

az mysql server private-endpoint-connection approve

Approve the specified private endpoint connection associated with a MySQL server.

az mysql server private-endpoint-connection delete

Delete the specified private endpoint connection associated with a MySQL server.

az mysql server private-endpoint-connection reject

Reject the specified private endpoint connection associated with a MySQL server.

az mysql server private-endpoint-connection show

Show details of a private endpoint connection associated with a MySQL server.

az mysql server private-link-resource

Manage MySQL server private link resources.

az mysql server private-link-resource list

List the private link resources supported for a MySQL server.

az mysql server replica

Manage read replicas.

az mysql server replica create

Create a read replica for a server.

az mysql server replica list

List all read replicas for a given server.

az mysql server replica stop

Stop replication to a read replica and make it a read/write server.

az mysql server restart

Restart a server.

az mysql server restore

Restore a server from backup.

az mysql server show

Get the details of a server.

az mysql server show-connection-string

Show the connection strings for a MySQL server database.

az mysql server start

Start a stopped server.

az mysql server stop

Stop a running server.

az mysql server update

Update a server.

az mysql server upgrade

Upgrade mysql server to a higher version, like 5.6 to 5.7.

az mysql server vnet-rule

Manage a server's virtual network rules.

az mysql server vnet-rule create

Create a virtual network rule to allows access to a MySQL server.

az mysql server vnet-rule delete

Deletes the virtual network rule with the given name.

az mysql server vnet-rule list

Gets a list of virtual network rules in a server.

az mysql server vnet-rule show

Gets a virtual network rule.

az mysql server vnet-rule update

Update a virtual network rule.

az mysql server wait

Wait for server to satisfy certain conditions.

az mysql server create

Create a server.

az mysql server create [--admin-password]
                       [--admin-user]
                       [--assign-identity]
                       [--auto-grow {Disabled, Enabled}]
                       [--backup-retention]
                       [--geo-redundant-backup {Disabled, Enabled}]
                       [--infrastructure-encryption {Disabled, Enabled}]
                       [--location]
                       [--minimal-tls-version {TLS1_0, TLS1_1, TLS1_2, TLSEnforcementDisabled}]
                       [--name]
                       [--public]
                       [--resource-group]
                       [--sku-name]
                       [--ssl-enforcement {Disabled, Enabled}]
                       [--storage-size]
                       [--subscription]
                       [--tags]
                       [--version]

Examples

Create a MySQL server in North Europe with sku GP_Gen5_2 (General Purpose, Gen 5 hardware, 2 vCores).

az mysql server create -l northeurope -g testgroup -n testsvr -u username -p password \
    --sku-name GP_Gen5_2

Create a MySQL server with all paramaters set.

az mysql server create -l northeurope -g testgroup -n testsvr -u username -p password \
    --sku-name B_Gen5_1 --ssl-enforcement Enabled --minimal-tls-version TLS1_0 --public-network-access Disabled \
    --backup-retention 10 --geo-redundant-backup Enabled --storage-size 51200 \
    --tags "key=value" --version 5.7

Optional Parameters

--admin-password -p

The password of the administrator. Minimum 8 characters and maximum 128 characters. Password must contain characters from three of the following categories: English uppercase letters, English lowercase letters, numbers, and non-alphanumeric characters.

--admin-user -u

Administrator username for the server. Once set, it cannot be changed.

default value: juniormacaw4
--assign-identity

Generate and assign an Azure Active Directory Identity for this server for use with key management services like Azure KeyVault.

--auto-grow

Enable or disable autogrow of the storage. Default value is Enabled.

accepted values: Disabled, Enabled
default value: Enabled
--backup-retention

The number of days a backup is retained. Range of 7 to 35 days. Default is 7 days.

--geo-redundant-backup

Enable or disable geo-redundant backups. Default value is Disabled. Not supported in Basic pricing tier.

accepted values: Disabled, Enabled
--infrastructure-encryption -i

Add an optional second layer of encryption for data using new encryption algorithm. Default value is Disabled.

accepted values: Disabled, Enabled
--location -l

Location. Values from: az account list-locations. You can configure the default location using az configure --defaults location=<location>.

--minimal-tls-version

Set the minimal TLS version for connections to server when SSL is enabled. Default is TLSEnforcementDisabled.

accepted values: TLS1_0, TLS1_1, TLS1_2, TLSEnforcementDisabled
--name -n

Name of the server. The name can contain only lowercase letters, numbers, and the hyphen (-) character. Minimum 3 characters and maximum 63 characters.

--public --public-network-access

Enable or disable public network access to server. When disabled, only connections made through Private Links can reach this server. Allowed values are : Enabled, Disabled, all, 0.0.0.0, , . Default is Enabled.

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

--sku-name

The name of the sku. Follows the convention {pricing tier}{compute generation}{vCores} in shorthand. Examples: B_Gen5_1, GP_Gen5_4, MO_Gen5_16.

default value: GP_Gen5_2
--ssl-enforcement

Enable or disable ssl enforcement for connections to server. Default is Enabled.

accepted values: Disabled, Enabled
--storage-size

The storage capacity of the server (unit is megabytes). Minimum 5120 and increases in 1024 increments. Default is 51200.

default value: 51200
--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--tags

Space-separated tags: key[=value] [key[=value] ...]. Use "" to clear existing tags.

--version

Server major version.

az mysql server delete

Delete a server.

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

Examples

Delete a server.

az mysql server delete -g testgroup -n testsvr

Optional Parameters

--ids

One or more resource IDs (space-delimited). It should be a complete resource ID containing all information of 'Resource Id' arguments. You should provide either --ids or other 'Resource Id' arguments.

--name -n

Name of the server. The name can contain only lowercase letters, numbers, and the hyphen (-) character. Minimum 3 characters and maximum 63 characters.

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--yes -y

Do not prompt for confirmation.

az mysql server georestore

Geo-restore a server from backup.

az mysql server georestore --location
                           --source-server
                           [--backup-retention]
                           [--geo-redundant-backup]
                           [--ids]
                           [--name]
                           [--no-wait]
                           [--resource-group]
                           [--sku-name]
                           [--subscription]

Examples

Geo-restore 'testsvr' into a new server 'testsvrnew' located in West US 2.

az mysql server georestore -g testgroup -n testsvrnew --source-server testsvr -l westus2

Geo-restore 'testsvr' into a new server 'testsvrnew' located in West US 2 with sku GP_Gen5_2.

az mysql server georestore -g testgroup -n testsvrnew --source-server testsvr -l westus2 --sku-name GP_Gen5_2

Geo-restore 'testsvr2' into a new server 'testsvrnew', where 'testsvrnew' is in a different resource group from 'testsvr2'.

az mysql server georestore -g testgroup -n testsvrnew \
    -s "/subscriptions/${SubID}/resourceGroups/${ResourceGroup}/providers/Microsoft.DBforMySQL/servers/testsvr2" \
    -l westus2

Required Parameters

--location -l

Location. Values from: az account list-locations. You can configure the default location using az configure --defaults location=<location>.

--source-server -s

The name or ID of the source server to restore from.

Optional Parameters

--backup-retention

The number of days a backup is retained. Range of 7 to 35 days. Default is 7 days.

--geo-redundant-backup

Enable or disable geo-redundant backups. Default value is Disabled. Not supported in Basic pricing tier.

--ids

One or more resource IDs (space-delimited). It should be a complete resource ID containing all information of 'Resource Id' arguments. You should provide either --ids or other 'Resource Id' arguments.

--name -n

Name of the server. The name can contain only lowercase letters, numbers, and the hyphen (-) character. Minimum 3 characters and maximum 63 characters.

--no-wait

Do not wait for the long-running operation to finish.

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

--sku-name

The name of the sku. Defaults to sku of the source server. Follows the convention {pricing tier}{compute generation}{vCores} in shorthand. Examples: B_Gen5_1, GP_Gen5_4, MO_Gen5_16.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

az mysql server list

List available servers.

az mysql server list [--query-examples]
                     [--resource-group]
                     [--subscription]

Examples

List all MySQL servers in a subscription.

az mysql server list

List all MySQL servers in a resource group.

az mysql server list -g testgroup

Optional Parameters

--query-examples

Recommend JMESPath string for you. You can copy one of the query and paste it after --query parameter within double quotation marks to see the results. You can add one or more positional keywords so that we can give suggestions based on these key words.

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

az mysql server list-skus

List available sku's in the given region.

az mysql server list-skus --location
                          [--subscription]

Examples

List available sku's in the given region.

az mysql server list-skus -l eastus

Required Parameters

--location -l

The name of the location.

Optional Parameters

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

az mysql server restart

Restart a server.

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

Examples

Restart a server.

az mysql server restart -g testgroup -n testsvr

Restart a server. (autogenerated)

az mysql server restart --name testsvr --resource-group testgroup --subscription MySubscription

Optional Parameters

--ids

One or more resource IDs (space-delimited). It should be a complete resource ID containing all information of 'Resource Id' arguments. You should provide either --ids or other 'Resource Id' arguments.

--name -n

Name of the server. The name can contain only lowercase letters, numbers, and the hyphen (-) character. Minimum 3 characters and maximum 63 characters.

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

az mysql server restore

Restore a server from backup.

az mysql server restore --pitr-time
                        --source-server
                        [--ids]
                        [--name]
                        [--no-wait]
                        [--resource-group]
                        [--subscription]

Examples

Restore 'testsvr' to a specific point-in-time as a new server 'testsvrnew'.

az mysql server restore -g testgroup -n testsvrnew --source-server testsvr --restore-point-in-time "2017-06-15T13:10:00Z"

Restore 'testsvr2' to 'testsvrnew', where 'testsvrnew' is in a different resource group from 'testsvr2'.

az mysql server restore -g testgroup -n testsvrnew \
    -s "/subscriptions/${SubID}/resourceGroups/${ResourceGroup}/providers/Microsoft.DBforMySQL/servers/testsvr2" \
    --restore-point-in-time "2017-06-15T13:10:00Z"

Required Parameters

--pitr-time --restore-point-in-time

The point in time in UTC to restore from (ISO8601 format), e.g., 2017-04-26T02:10:00+08:00.

--source-server -s

The name or resource ID of the source server to restore from.

Optional Parameters

--ids

One or more resource IDs (space-delimited). It should be a complete resource ID containing all information of 'Resource Id' arguments. You should provide either --ids or other 'Resource Id' arguments.

--name -n

Name of the server. The name can contain only lowercase letters, numbers, and the hyphen (-) character. Minimum 3 characters and maximum 63 characters.

--no-wait

Do not wait for the long-running operation to finish.

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

az mysql server show

Get the details of a server.

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

Examples

Get the details of a server

az mysql server show --name MyServer --resource-group MyResourceGroup

Optional Parameters

--ids

One or more resource IDs (space-delimited). It should be a complete resource ID containing all information of 'Resource Id' arguments. You should provide either --ids or other 'Resource Id' arguments.

--name -n

Name of the server. The name can contain only lowercase letters, numbers, and the hyphen (-) character. Minimum 3 characters and maximum 63 characters.

--query-examples

Recommend JMESPath string for you. You can copy one of the query and paste it after --query parameter within double quotation marks to see the results. You can add one or more positional keywords so that we can give suggestions based on these key words.

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

az mysql server show-connection-string

Show the connection strings for a MySQL server database.

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

Examples

Show connection strings for cmd and programming languages.

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

Optional Parameters

--admin-password -p

The login password of the administrator.

default value: {password}
--admin-user -u

The login username of the administrator.

default value: {username}
--database-name -d

The name of a database.

default value: {database}
--ids

One or more resource IDs (space-delimited). It should be a complete resource ID containing all information of 'Resource Id' arguments. You should provide either --ids or other 'Resource Id' arguments.

--server-name -s

Name of the server.

default value: {server}
--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

az mysql server start

Start a stopped server.

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

Examples

Start a stopped server. (autogenerated)

az mysql server start --name testsvr --resource-group testgroup --subscription MySubscription

Optional Parameters

--ids

One or more resource IDs (space-delimited). It should be a complete resource ID containing all information of 'Resource Id' arguments. You should provide either --ids or other 'Resource Id' arguments.

--name -n

Name of the server. The name can contain only lowercase letters, numbers, and the hyphen (-) character. Minimum 3 characters and maximum 63 characters.

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

az mysql server stop

Stop a running server.

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

Examples

Stop a running server. (autogenerated)

az mysql server stop --name testsvr --resource-group testgroup --subscription MySubscription

Optional Parameters

--ids

One or more resource IDs (space-delimited). It should be a complete resource ID containing all information of 'Resource Id' arguments. You should provide either --ids or other 'Resource Id' arguments.

--name -n

Name of the server. The name can contain only lowercase letters, numbers, and the hyphen (-) character. Minimum 3 characters and maximum 63 characters.

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

az mysql server update

Update a server.

az mysql server update [--add]
                       [--admin-password]
                       [--assign-identity]
                       [--auto-grow {Disabled, Enabled}]
                       [--backup-retention]
                       [--force-string]
                       [--ids]
                       [--minimal-tls-version {TLS1_0, TLS1_1, TLS1_2, TLSEnforcementDisabled}]
                       [--name]
                       [--public]
                       [--remove]
                       [--resource-group]
                       [--set]
                       [--sku-name]
                       [--ssl-enforcement {Disabled, Enabled}]
                       [--storage-size]
                       [--subscription]
                       [--tags]

Examples

Update a server's sku.

az mysql server update -g testgroup -n testsvrnew --sku-name GP_Gen5_4

Update a server's tags.

az mysql server update -g testgroup -n testsvrnew --tags "k1=v1" "k2=v2"

Update a server. (autogenerated)

az mysql server update --name testsvrnew --resource-group testgroup --ssl-enforcement Enabled --minimal-tls-version TLS1_0

Optional Parameters

--add

Add an object to a list of objects by specifying a path and key value pairs. Example: --add property.listProperty <key=value, string or JSON string>.

--admin-password -p

The password of the administrator. Minimum 8 characters and maximum 128 characters. Password must contain characters from three of the following categories: English uppercase letters, English lowercase letters, numbers, and non-alphanumeric characters.

--assign-identity

Generate and assign an Azure Active Directory Identity for this server for use with key management services like Azure KeyVault.

--auto-grow

Enable or disable autogrow of the storage. Default value is Enabled.

accepted values: Disabled, Enabled
--backup-retention

The number of days a backup is retained. Range of 7 to 35 days. Default is 7 days.

--force-string

When using 'set' or 'add', preserve string literals instead of attempting to convert to JSON.

--ids

One or more resource IDs (space-delimited). It should be a complete resource ID containing all information of 'Resource Id' arguments. You should provide either --ids or other 'Resource Id' arguments.

--minimal-tls-version

Set the minimal TLS version for connections to server when SSL is enabled. Default is TLSEnforcementDisabled.

accepted values: TLS1_0, TLS1_1, TLS1_2, TLSEnforcementDisabled
--name -n

Name of the server. The name can contain only lowercase letters, numbers, and the hyphen (-) character. Minimum 3 characters and maximum 63 characters.

--public --public-network-access

Enable or disable public network access to server. When disabled, only connections made through Private Links can reach this server. Allowed values are : Enabled, Disabled, all, 0.0.0.0, , . Default is Enabled.

--remove

Remove a property or an element from a list. Example: --remove property.list OR --remove propertyToRemove.

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

--set

Update an object by specifying a property path and value to set. Example: --set property1.property2=.

--sku-name

The name of the sku. Follows the convention {pricing tier}{compute generation}{vCores} in shorthand. Examples: B_Gen5_1, GP_Gen5_4, MO_Gen5_16.

--ssl-enforcement

Enable or disable ssl enforcement for connections to server. Default is Enabled.

accepted values: Disabled, Enabled
--storage-size

The storage capacity of the server (unit is megabytes). Minimum 5120 and increases in 1024 increments. Default is 51200.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--tags

Space-separated tags: key[=value] [key[=value] ...]. Use "" to clear existing tags.

az mysql server upgrade

Upgrade mysql server to a higher version, like 5.6 to 5.7.

az mysql server upgrade --target-server-version
                        [--ids]
                        [--name]
                        [--resource-group]
                        [--subscription]

Examples

Upgrade mysql server.

az mysql server upgrade --name testsvr --resource-group testgroup --subscription MySubscription --target-server-version 5.7

Required Parameters

--target-server-version -t

The server version you want to upgrade your mysql server to, currently only support 5.7.

Optional Parameters

--ids

One or more resource IDs (space-delimited). It should be a complete resource ID containing all information of 'Resource Id' arguments. You should provide either --ids or other 'Resource Id' arguments.

--name -n

Name of the server. The name can contain only lowercase letters, numbers, and the hyphen (-) character. Minimum 3 characters and maximum 63 characters.

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

az mysql server wait

Wait for server to satisfy certain conditions.

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

Examples

Wait for server to satisfy certain conditions. (autogenerated)

az mysql server wait --exists --name MyServer --resource-group MyResourceGroup

Optional Parameters

--custom

Wait until the condition satisfies a custom JMESPath query. E.g. provisioningState!='InProgress', instanceView.statuses[?code=='PowerState/running'].

--exists

Wait until the resource exists.

--ids

One or more resource IDs (space-delimited). It should be a complete resource ID containing all information of 'Resource Id' arguments. You should provide either --ids or other 'Resource Id' arguments.

--interval

Polling interval in seconds.

default value: 30
--name -n

Name of the server. The name can contain only lowercase letters, numbers, and the hyphen (-) character. Minimum 3 characters and maximum 63 characters.

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--timeout

Maximum wait in seconds.

default value: 3600