-
Notifications
You must be signed in to change notification settings - Fork 326
/
change-server-configurations.sh
41 lines (32 loc) · 1.73 KB
/
change-server-configurations.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/bin/bash
# Passed validation in Cloud Shell on 2/9/2022
# <FullScript>
# List and update configurations of an Azure Database for MySQL server
# Variable block
let "randomIdentifier=$RANDOM*$RANDOM"
location="East US"
resourceGroup="msdocs-mysql-rg-$randomIdentifier"
tag="change-server-cofigurations-mysql"
server="msdocs-mysql-server-$randomIdentifier"
sku="GP_Gen5_2"
login="azureuser"
password="Pa$$w0rD-$randomIdentifier"
echo "Using resource group $resourceGroup with login: $login, password: $password..."
# Create a resource group
echo "Creating $resourceGroup in $location..."
az group create --name $resourceGroup --location "$location" --tags $tag
# Create a MySQL server in the resource group
# Name of a server maps to DNS name and is thus required to be globally unique in Azure.
echo "Creating $server in $location..."
az mysql server create --name $server --resource-group $resourceGroup --location "$location" --admin-user $login --admin-password $password --sku-name $sku
# Display all available configurations with valid values of an Azure Database for MySQL server
az mysql server configuration list --resource-group $resourceGroup --server-name $server
# Set value of *innodb_lock_wait_timeout*
echo "Setting value of the innodb_lock_wait_timeout setting on $server"
az mysql server configuration set --resource-group $resourceGroup --server-name $server --name innodb_lock_wait_timeout --value 120
# Check the value of *innodb_lock_wait_timeout*
echo "Checking the value of the innodb_lock_wait_timeout setting on $server"
az mysql server configuration show --resource-group $resourceGroup --server-name $server --name innodb_lock_wait_timeout
# </FullScript>
# echo "Deleting all resources"
# az group delete --name $resourceGroup -y