Configure server parameters in Azure Database for MySQL using PowerShell
APPLIES TO: Azure Database for MySQL - Single Server
Important
Azure Database for MySQL single server is on the retirement path. We strongly recommend that you upgrade to Azure Database for MySQL flexible server. For more information about migrating to Azure Database for MySQL flexible server, see What's happening to Azure Database for MySQL Single Server?
You can list, show, and update configuration parameters for an Azure Database for MySQL server using PowerShell. A subset of engine configurations is exposed at the server-level and can be modified.
Note
Server parameters can be updated globally at the server-level, use the Azure CLI, PowerShell, or Azure portal.
Prerequisites
To complete this how-to guide, you need:
- The Az PowerShell module installed locally.
- An Azure Database for MySQL server
Important
While the Az.MySql PowerShell module is in preview, you must install it separately from the Az
PowerShell module using the following command: Install-Module -Name Az.MySql -AllowPrerelease
.
Once the Az.MySql PowerShell module is generally available, it becomes part of future Az
PowerShell module releases.
Connect to your Azure account using the Connect-AzAccount cmdlet.
List server configuration parameters for Azure Database for MySQL server
To list all modifiable parameters in a server and their values, run the Get-AzMySqlConfiguration
cmdlet.
The following example lists the server configuration parameters for the server mydemoserver in resource group myresourcegroup.
Get-AzMySqlConfiguration -ResourceGroupName myresourcegroup -ServerName mydemoserver
For the definition of each of the listed parameters, see the MySQL reference section on Server System Variables.
Show server configuration parameter details
To show details about a particular configuration parameter for a server, run the
Get-AzMySqlConfiguration
cmdlet and specify the Name parameter.
This example shows details of the slow_query_log server configuration parameter for server mydemoserver under resource group myresourcegroup.
Get-AzMySqlConfiguration -Name slow_query_log -ResourceGroupName myresourcegroup -ServerName mydemoserver
Modify a server configuration parameter value
You can also modify the value of a certain server configuration parameter, which updates the
underlying configuration value for the MySQL server engine. To update the configuration, use the
Update-AzMySqlConfiguration
cmdlet.
To update the slow_query_log server configuration parameter of server mydemoserver under resource group myresourcegroup.
Update-AzMySqlConfiguration -Name slow_query_log -ResourceGroupName myresourcegroup -ServerName mydemoserver -Value On