Restart/stop/start an Azure Database for MySQL - Flexible Server instance

APPLIES TO: Azure Database for MySQL - Flexible Server

This article shows you how to perform restart, start and stop an Azure Database for MySQL flexible server instance by using Azure CLI.

Prerequisites

  • An Azure account with an active subscription.

    If you don't have an Azure subscription, create an Azure free account before you begin. Currently, with an Azure free account, you can try Azure Database for MySQL - Flexible Server free for 12 months. For more information, see Try Azure Database for MySQL - Flexible Server for free.

  • Install or upgrade Azure CLI to the latest version. See Install Azure CLI.

  • Login to Azure account using az login command. Note the id property, which refers to Subscription ID for your Azure account.

    az login
    
  • If you have multiple subscriptions, choose the appropriate subscription in which you want to create the server using the az account set command. `

    az account set --subscription <subscription id>
    
  • Create an Azure Database for MySQL flexible server instance if you haven't already created one by using the az mysql flexible-server create command.

    az mysql flexible-server create --resource-group myresourcegroup --name myservername
    

Stop a running server

To stop a server, run the az mysql flexible-server stop command. If you use local context, you don't need to provide any arguments.

Usage:

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

Example without local context:

az mysql flexible-server stop  --resource-group --name myservername

Example with local context:

az mysql flexible-server stop

Start a stopped server

To start a server, run the az mysql flexible-server start command. If you use local context, you don't need to provide any arguments.

Usage:

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

Example without local context:

az mysql flexible-server start  --resource-group --name myservername

Example with local context:

az mysql flexible-server start

Important

Once the server has restarted successfully, all management operations are now available for the Azure Database for MySQL flexible server instance.

Restart a server

To restart a server, run the az mysql flexible-server restart command. If you use local context, you don't need to provide any arguments.

Note

If the user restarting the server is part of custom role the user should have write privilege on the server.

Usage:

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

Example without local context:

az mysql flexible-server restart  --resource-group --name myservername

Example with local context:

az mysql flexible-server restart

Important

Once the server has restarted successfully, all management operations are now available for the Azure Database for MySQL flexible server instance.

Next steps