az mysql flexible-server

Manage Azure Database for MySQL Flexible Servers.

Commands

az mysql flexible-server connect

Connect to a flexible server.

az mysql flexible-server create

Create a flexible server.

az mysql flexible-server db

Manage MySQL databases on a flexible server.

az mysql flexible-server db create

Create a MySQL database on a flexible server.

az mysql flexible-server db delete

Delete a database on a flexible server.

az mysql flexible-server db list

List the databases for a flexible server.

az mysql flexible-server db show

Show the details of a database.

az mysql flexible-server delete

Delete a flexible server.

az mysql flexible-server deploy

Enable and run github action workflow for MySQL server.

az mysql flexible-server deploy run

Run an existing workflow in your github repository.

az mysql flexible-server deploy setup

Create github action workflow file for MySQL server.

az mysql flexible-server execute

Connect to a flexible server.

az mysql flexible-server firewall-rule

Manage firewall rules for a server.

az mysql flexible-server firewall-rule create

Create a new firewall rule for a flexible server.

az mysql flexible-server firewall-rule delete

Delete a firewall rule.

az mysql flexible-server firewall-rule list

List all firewall rules for a flexible server.

az mysql flexible-server firewall-rule show

Get the details of a firewall rule.

az mysql flexible-server firewall-rule update

Update a firewall rule.

az mysql flexible-server list

List available flexible servers.

az mysql flexible-server list-skus

Lists available sku's in the given region.

az mysql flexible-server parameter

Commands for managing server parameter values for flexible server.

az mysql flexible-server parameter list

List the parameter values for a flexible server.

az mysql flexible-server parameter set

Update the parameter of a flexible server.

az mysql flexible-server parameter show

Get the parameter for a flexible server.".

az mysql flexible-server replica

Manage read replicas.

az mysql flexible-server replica create

Create a read replica for a server.

az mysql flexible-server replica list

List all read replicas for a given server.

az mysql flexible-server replica stop-replication

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

az mysql flexible-server restart

Restart a flexible server.

az mysql flexible-server restore

Restore a flexible server from backup.

az mysql flexible-server show

Get the details of a flexible server.

az mysql flexible-server show-connection-string

Show the connection strings for a MySQL flexible-server database.

az mysql flexible-server start

Start a flexible server.

az mysql flexible-server stop

Stop a flexible server.

az mysql flexible-server update

Update a flexible server.

az mysql flexible-server wait

Wait for the flexible server to satisfy certain conditions.

az mysql flexible-server connect

Connect to a flexible server.

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

Required Parameters

--admin-user -u

The login username of the administrator.

--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.

Optional Parameters

--admin-password -p

The login password of the administrator.

--database-name -d

The name of a database.

--interactive

Pass this parameter to connect to database in interactive mode.

--querytext -q

A query to run against the flexible server.

az mysql flexible-server create

Create a flexible server.

az mysql flexible-server create [--address-prefixes]
                                [--admin-password]
                                [--admin-user]
                                [--assign-identity]
                                [--backup-retention]
                                [--database-name]
                                [--high-availability]
                                [--iops]
                                [--location]
                                [--name]
                                [--public-access]
                                [--resource-group]
                                [--sku-name]
                                [--storage-auto-grow {Disabled, Enabled}]
                                [--storage-size]
                                [--subnet]
                                [--subnet-prefixes]
                                [--subscription]
                                [--tags]
                                [--tier]
                                [--version]
                                [--vnet]
                                [--zone]

Examples

Create a MySQL flexible server with default params (resource group, location, servername, username, password) with VNET enabled by default.

az mysql flexible-server create

Create a MySQL flexible server with default params (resource group, location, servername, username, password) with all public IPs (0.0.0.0 - 255.255.255.255).

az mysql flexible-server create --public-access all

Create a MySQL flexible server with default params ( resource group, location, servername, username, password ) with public access without any firewall rules.

az mysql flexible-server create --public-access none

Create a MySQL flexible server with public access and add client IP address to have access to the server

az mysql flexible-server create --public-access <my_client_ip>

Create a MySQL flexible server with public access and add the range of IP address to have access to this server

az mysql flexible-server create --public-access <start_ip_address-end_ip_address>

Create a MySQL flexible server with public access and allow applications from Azure IP addresses to connect to your flexible server

az mysql flexible-server create --public-access 0.0.0.0

Create a MySQL flexible server with specified SKU and storage, using defaults from local context.

az mysql flexible-server create --name testServer --admin-password password

Create a MySQL flexible server using already existing virtual network and subnet. If provided virtual network and subnet does not exists then virtual network and subnet with default address prefix will be created.

az mysql flexible-server create --vnet myVnet --subnet mySubnet

Create a MySQL flexible server using already existing virtual network, subnet, and using the subnet ID. The provided subnet should not have any other resource deployed in it and this subnet will be delegated to Microsoft.DBforMySQL/flexibleServers, if not already delegated.

az mysql flexible-server create --subnet /subscriptions/{SubID}/resourceGroups/{ResourceGroup}/providers/Microsoft.Network/virtualNetworks/{VNetName}/subnets/{SubnetName}

Create a MySQL flexible server using new virtual network, subnet with non-default address prefix.

az mysql flexible-server create --vnet myVnet --address-prefixes 10.0.0.0/24 --subnet mySubnet --subnet-prefixes 10.0.0.0/24

Create a MySQL flexible server with parameters set.

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

Optional Parameters

--address-prefixes

The IP address prefix to use when creating a new virtual network in CIDR format. Default value is 10.0.0.0/16.

--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: lastmacaw6
--assign-identity

Generate and assign an Azure Active Directory Identity for this server for use with key management services like Azure KeyVault. No need to enter extra argument.

--backup-retention

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

default value: 7
--database-name -d

The name of the database to be created when provisioning the database server.

--high-availability

Enable or disable high availability feature. Default value is Disabled. High availability can only be set during flexible server create time.

default value: Disabled
--iops

Number of IOPS to be allocated for this server. You will get certain amount of free IOPS based on compute and storage provisioned. The default value for IOPS is free IOPS. To learn more about IOPS based on compute and storage, refer to IOPS in Azure Database for MySQL Flexible Server.

--location -l

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

--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-access

Determines the public access. Enter single or range of IP addresses to be included in the allowed list of IPs. IP address ranges must be dash-separated and not contain any spaces. Specifying 0.0.0.0 allows public access from any resources deployed within Azure to access your server. Setting it to "None" sets the server in public access mode but does not create a firewall rule.

--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 compute SKU. Follows the convention Standard_{VM name}. Examples: Standard_B1ms, Standard_E16ds_v4.

default value: Standard_B1ms
--storage-auto-grow

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

accepted values: Disabled, Enabled
default value: Enabled
--storage-size

The storage capacity of the server. Minimum is 5 GiB and increases in 1 GiB increments. Max is 16 TiB.

default value: 32
--subnet

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 provider. After delegation, this subnet cannot be used for any other type of Azure resources.

--subnet-prefixes

The subnet IP address prefix to use when creating a new VNet in CIDR format. Default value is 10.0.0.0/24.

--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.

--tier

Compute tier of the server. Accepted values: Burstable, GeneralPurpose, Memory Optimized.

default value: Burstable
--version

Server major version.

default value: 5.7
--vnet

Name or ID of a new or existing virtual network. If you want to use a vnet from different resource group or subscription, please provide a resource ID. The name must be between 2 to 64 characters. The name must begin with a letter or number, end with a letter, number or underscore, and may contain only letters, numbers, underscores, periods, or hyphens.

--zone -z

Availability zone into which to provision the resource.

az mysql flexible-server delete

Delete a flexible server.

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

Examples

Delete a flexible server.

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

Delete a flexible server without prompt or confirmation.

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

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 flexible-server execute

Connect to a flexible server.

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

Required Parameters

--admin-password -p

The login password of the administrator.

--admin-user -u

The login username of the administrator.

--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.

Optional Parameters

--database-name -d

The name of a database.

--file-path -f

The path of the sql file to execute.

--querytext -q

A query to run against the flexible server.

az mysql flexible-server list

List available flexible servers.

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

Examples

List all MySQL flexible servers in a subscription.

az mysql flexible-server list

List all MySQL flexible servers in a resource group.

az mysql flexible-server list --resource-group 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 flexible-server list-skus

Lists available sku's in the given region.

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

Examples

Lists available sku's in the given region.

az mysql flexible-server list-skus -l eastus

Required Parameters

--location -l

Location. Values from: az account list-locations. You can configure the default location using az configure --defaults location=<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 flexible-server restart

Restart a flexible server.

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

Examples

Restart a flexible server.

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

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 flexible-server restore

Restore a flexible server from backup.

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

Examples

Restore 'testServer' to a specific point-in-time as a new server 'testServerNew'.

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

Restore 'testServer2' to 'testServerNew', where 'testServerNew' is in a different resource group from 'testServer2'.

az mysql flexible-server restore --resource-group testGroup --name testServerNew \
  --source-server "/subscriptions/${SubID}/resourceGroups/${ResourceGroup}/providers/Microsoft.DBforMySQL/servers/testServer2" \
  --restore-time "2017-06-15T13:10:00Z"

Required Parameters

--restore-time

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

default value: 2021-07-14T10:24:12+00:00
--source-server

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.

--location -l

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

--name -n

The name of the new server that is created by the restore command.

--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 flexible-server show

Get the details of a flexible server.

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

Examples

Get the details of a flexible server

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

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 flexible-server show-connection-string

Show the connection strings for a MySQL flexible-server database.

az mysql flexible-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 flexible-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: {login}
--database-name -d

The name of the 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 flexible-server start

Start a flexible server.

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

Examples

Start a flexible server.

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

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 flexible-server stop

Stop a flexible server.

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

Examples

Stop a flexible server.

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

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 flexible-server update

Update a flexible server.

az mysql flexible-server update [--add]
                                [--admin-password]
                                [--backup-retention]
                                [--force-string]
                                [--high-availability {Disabled, Enabled}]
                                [--ids]
                                [--iops]
                                [--maintenance-window]
                                [--name]
                                [--remove]
                                [--replication-role]
                                [--resource-group]
                                [--set]
                                [--sku-name]
                                [--ssl-enforcement {Disabled, Enabled}]
                                [--storage-auto-grow {Disabled, Enabled}]
                                [--storage-size]
                                [--subnet]
                                [--subscription]
                                [--tags]
                                [--tier]

Examples

Update a flexible server's sku, using local context for server and resource group.

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

Update a flexible server's tags.

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

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.

--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.

--high-availability

Enable or disable high availability feature. Default value is Disabled.

accepted values: Disabled, Enabled
--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.

--iops

Number of IOPS to be allocated for this server. You will get certain amount of free IOPS based on compute and storage provisioned. The default value for IOPS is free IOPS. To learn more about IOPS based on compute and storage, refer to IOPS in Azure Database for MySQL Flexible Server.

--maintenance-window

Period of time (UTC) designated for maintenance. Examples: "Sun:23:30" to schedule on Sunday, 11:30pm UTC. To set back to default pass in "Disabled".

--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.

--remove

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

--replication-role

The replication role of the server.

--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 compute SKU. Follows the convention Standard_{VM name}. Examples: Standard_B1ms, Standard_E16ds_v4.

--ssl-enforcement

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

accepted values: Disabled, Enabled
--storage-auto-grow

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

accepted values: Disabled, Enabled
--storage-size

The storage capacity of the server. Minimum is 5 GiB and increases in 1 GiB increments. Max is 16 TiB.

--subnet

Name or ID of the subnet that allows access to an Azure Flexible Server MySQL Server.

--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.

--tier

Compute tier of the server. Accepted values: Burstable, GeneralPurpose, Memory Optimized.

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]

Examples

Wait for the flexible server to satisfy certain conditions.

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

Optional Parameters

--created

Wait until created with 'provisioningState' at 'Succeeded'.

--custom

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

--deleted

Wait until deleted.

--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
--updated

Wait until updated with provisioningState at 'Succeeded'.