Azure/Databases

From Ever changing code
Jump to navigation Jump to search

Azure constantly improves databases offering on its cloud platform. So, things here can quickly get outdated.

SQL Servers and SQL databases

These are Microsoft SQL server implementations

Azure Database MySQL servers

Enable connectivity

As of writing this Azure Connection Security it breaks down to two concepts:

  • Rule Name (IP rules): is database-level access allowing IP(s) to connect from Internet, aka Limit to Hosts Matching: %, although you won't see this in the database
  • VNET Rules: is server-level rule that allows to connect from a specified VNET's subnet(s). All subnets must reside in the same region. Virtual network rules are based on Virtual Network service endpoints.

MySQL client connection

Below it's working example of connecting to Azure MySQL managed database service. Note:

  • required username myroot@db-1-rw-euw1-sandbox
    • myroot is a db user in SELECT User FROM mysql.user;
    • db-1-rw-euw1-sandbox is mysql database server name
mysql --host <fully qualified server name> --user <server admin login name>@<server name> -p
mysql --host db-1-rw-euw1-sandbox.mysql.database.azure.com -u myroot@db-1-rw-euw1-sandbox -pPass123%


By default followign users are existing in Azure MySQL server

mysql> SELECT User FROM mysql.user;
+------------------+
| User             |
+------------------+
| az00cb7874715555 |
| myroot           |
| azure_superuser  |
| azure_superuser  |
| mysql.session    |
| mysql.sys        |
+------------------+
6 rows in set (0.01 sec)

Connection details

mysql> status;
--------------
mysql  Ver 14.14 Distrib 5.7.24, for Linux (x86_64) using  EditLine wrapper

Connection id:          64986
Current database:
Current user:           myroot@10.10.1.4
SSL:                    Cipher in use is AES256-SHA
Current pager:          stdout
Using outfile:          ''
Using delimiter:        ;
Server version:         5.6.39.0 MySQL Community Server (GPL)
Protocol version:       10
Connection:             db-1-rw-euw1-sandbox.mysql.database.azure.com via TCP/IP
Server characterset:    latin1
Db     characterset:    latin1
Client characterset:    utf8
Conn.  characterset:    utf8
TCP port:               3306
Uptime:                 8 hours 13 min 31 sec

Threads: 9  Questions: 8566  Slow queries: 0  Opens: 119  Flush tables: 1  Open tables: 112  Queries per second avg: 0.289

Connection details:

show status like '%onn%';