|
| 1 | +--- |
| 2 | +title: Configure the service parameters in Azure Database for MariaDB |
| 3 | +description: This article describes how to configure the service parameters in Azure Database for MariaDB using the Azure CLI command line utility. |
| 4 | +services: mariadb |
| 5 | +author: ajlam |
| 6 | +ms.author: andrela |
| 7 | +manager: kfile |
| 8 | +editor: jasonwhowell |
| 9 | +ms.service: mariadb |
| 10 | +ms.devlang: azure-cli |
| 11 | +ms.topic: article |
| 12 | +ms.date: 11/09/2018 |
| 13 | +--- |
| 14 | +# Customize server configuration parameters by using Azure CLI |
| 15 | +You can list, show, and update configuration parameters for an Azure Database for MariaDB server by using Azure CLI, the Azure command-line utility. A subset of engine configurations is exposed at the server-level and can be modified. |
| 16 | + |
| 17 | +## Prerequisites |
| 18 | +To step through this how-to guide, you need: |
| 19 | +- [An Azure Database for MariaDB server](quickstart-create-mariadb-server-database-using-azure-cli.md) |
| 20 | +- [Azure CLI](/cli/azure/install-azure-cli) command-line utility or use the Azure Cloud Shell in the browser. |
| 21 | + |
| 22 | +## List server configuration parameters for Azure Database for MariaDB server |
| 23 | +To list all modifiable parameters in a server and their values, run the [az mariadb server configuration list](/cli/azure/mariadb/server/configuration#az-mariadb-server-configuration-list) command. |
| 24 | + |
| 25 | +You can list the server configuration parameters for the server **mydemoserver.mariadb.database.azure.com** under resource group **myresourcegroup**. |
| 26 | +```azurecli-interactive |
| 27 | +az mariadb server configuration list --resource-group myresourcegroup --server mydemoserver |
| 28 | +``` |
| 29 | + |
| 30 | +For the definition of each of the listed parameters, see the MariaDB reference section on [Server System Variables](https://mariadb.com/kb/en/library/server-system-variables/). |
| 31 | + |
| 32 | +## Show server configuration parameter details |
| 33 | +To show details about a particular configuration parameter for a server, run the [az mariadb server configuration show](/cli/azure/mariadb/server/configuration#az-mariadb-server-configuration-show) command. |
| 34 | + |
| 35 | +This example shows details of the **slow\_query\_log** server configuration parameter for server **mydemoserver.mariadb.database.azure.com** under resource group **myresourcegroup.** |
| 36 | +```azurecli-interactive |
| 37 | +az mariadb server configuration show --name slow_query_log --resource-group myresourcegroup --server mydemoserver |
| 38 | +``` |
| 39 | + |
| 40 | +## Modify a server configuration parameter value |
| 41 | +You can also modify the value of a certain server configuration parameter, which updates the underlying configuration value for the MariaDB server engine. To update the configuration, use the [az mariadb server configuration set](/cli/azure/mariadb/server/configuration#az-mariadb-server-configuration-set) command. |
| 42 | + |
| 43 | +To update the **slow\_query\_log** server configuration parameter of server **mydemoserver.mariadb.database.azure.com** under resource group **myresourcegroup.** |
| 44 | +```azurecli-interactive |
| 45 | +az mariadb server configuration set --name slow_query_log --resource-group myresourcegroup --server mydemoserver --value ON |
| 46 | +``` |
| 47 | + |
| 48 | +If you want to reset the value of a configuration parameter, omit the optional `--value` parameter, and the service applies the default value. For the example above, it would look like: |
| 49 | +```azurecli-interactive |
| 50 | +az mariadb server configuration set --name slow_query_log --resource-group myresourcegroup --server mydemoserver |
| 51 | +``` |
| 52 | + |
| 53 | +This code resets the **slow\_query\_log** configuration to the default value **OFF**. |
| 54 | + |
| 55 | +## Working with the time zone parameter |
| 56 | + |
| 57 | +### Populating the time zone tables |
| 58 | + |
| 59 | +The time zone tables on your server can be populated by calling the `az_load_timezone` stored procedure from a tool like the MariaDB command line or MariaDB Workbench. |
| 60 | + |
| 61 | +> [!NOTE] |
| 62 | +> If you are running the `az_load_timezone` command from MariaDB Workbench, you may need to turn off safe update mode first using `SET SQL_SAFE_UPDATES=0;`. |
| 63 | +
|
| 64 | +```sql |
| 65 | +CALL mysql.az_load_timezone(); |
| 66 | +``` |
| 67 | + |
| 68 | +To view available time zone values, run the following command: |
| 69 | + |
| 70 | +```sql |
| 71 | +SELECT name FROM mysql.time_zone_name; |
| 72 | +``` |
| 73 | + |
| 74 | +### Setting the global level time zone |
| 75 | + |
| 76 | +The global level time zone can be set using the [az mariadb server configuration set](/cli/azure/mariadb/server/configuration#az-mariadb-server-configuration-set) command. |
| 77 | + |
| 78 | +The following command updates the **time\_zone** server configuration parameter of server **mydemoserver.mariadb.database.azure.com** under resource group **myresourcegroup** to **US/Pacific**. |
| 79 | + |
| 80 | +```azurecli-interactive |
| 81 | +az mariadb server configuration set --name time_zone --resource-group myresourcegroup --server mydemoserver --value "US/Pacific" |
| 82 | +``` |
| 83 | + |
| 84 | +### Setting the session level time zone |
| 85 | + |
| 86 | +The session level time zone can be set by running the `SET time_zone` command from a tool like the MariaDB command line or MariaDB Workbench. The example below sets the time zone to the **US/Pacific** time zone. |
| 87 | + |
| 88 | +```sql |
| 89 | +SET time_zone = 'US/Pacific'; |
| 90 | +``` |
| 91 | + |
| 92 | +Refer to the MariaDB documentation for [Date and Time Functions](https://mariadb.com/kb/en/library/date-time-functions/). |
| 93 | + |
| 94 | +## Next steps |
| 95 | + |
| 96 | +- How to configure [server parameters in Azure portal](howto-server-parameters.md) |
0 commit comments