Learning and Sharing
  • Home
  • Blog
  • Linux
  • macOS
  • VirtualBox
  • VMware
  • Windows
  • Series
    • Symantec
    • Intune
    • Microsoft Azure
    • Powershell
    • VirtualBox
    • VMware
    • PowerShell Learning
    • Microsoft Graph
  • More
    • Auto Installation
    • AEC Installation
  • Contact
No Result
View All Result
  • Home
  • Blog
  • Linux
  • macOS
  • VirtualBox
  • VMware
  • Windows
  • Series
    • Symantec
    • Intune
    • Microsoft Azure
    • Powershell
    • VirtualBox
    • VMware
    • PowerShell Learning
    • Microsoft Graph
  • More
    • Auto Installation
    • AEC Installation
  • Contact
No Result
View All Result
No Result
View All Result

Azure MySQL SSL Connection is Required Please Specify SSL Options

August 16, 2022
in Blog, Microsoft Azure, Powershell
0
ADVERTISEMENT

Table of Contents

You get a connection failure when you try to connect to your MySQL server in Azure from your app/client, which does not have SSL enabled. The error message is as follows: SSL connection is required. Please specify SSL options and retry.

mysql -h westus-mysql1.mysql.database.azure.com -u sqladmin@westus-mysql1 -p
Enter password: 
ERROR 9002 (28000): SSL connection is required. Please specify SSL options and retry.

Disable requiring SSL for connecting to Azure MySQL database

By default, Azure Database for MySQL enforces SSL connections between your server and your client applications to protect against MITM (man in the middle) attacks. This is done to make the connection to your server as secure as possible.

Although not recommended, you have the option to disable requiring SSL for connecting to your server if your client application does not support SSL connectivity. You can disable requiring SSL connections from either the portal or using CLI.

Note Note that Azure does not recommend disabling requiring SSL connections when connecting to your server.

You can enable or disable the ssl-enforcement parameter by using Enabled or Disabled values respectively in Azure CLI.

az mysql server update --resource-group myresource --name mydemoserver --ssl-enforcement Enabled

Disable requiring SSL for connecting to Azure MySQL database using Azure portal.

Bg1642

Now, connect to the MySQL server without SSL:

mysql -h westus-mysql1.mysql.database.azure.com -u sqladmin@westus-mysql1 -p

Once you’ve connected, you can run status command to check the SSL configuration of the MySQL server.

mysql -h westus-mysql1.mysql.database.azure.com -u sqladmin@westus-mysql1 -p                                         
Enter password: 

Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MySQL connection id is 64355
Server version: 5.6.47.0 MySQL Community Server (GPL)

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MySQL [(none)]> status
--------------
/usr/bin/mysql  Ver 15.1 Distrib 10.3.34-MariaDB, for debian-linux-gnu (x86_64) using readline 5.2

Connection id:          64355
Current database:
Current user:           [email protected]
SSL:                    Not in use
Current pager:          stdout
Using outfile:          ''
Using delimiter:        ;
Server:                 MySQL
Server version:         5.6.47.0 MySQL Community Server (GPL)
Protocol version:       10
Connection:             westus-mysql1.mysql.database.azure.com via TCP/IP
Server characterset:    latin1
Db     characterset:    latin1
Client characterset:    utf8mb4
Conn.  characterset:    utf8mb4
TCP port:               3306
Uptime:                 31 min 8 sec

Threads: 11  Questions: 861  Slow queries: 0  Opens: 55  Flush tables: 2  Open tables: 25  Queries per second avg: 0.460
--------------
ADVERTISEMENT

Configure SSL to connect to Azure Database for MySQL

1. Download the certificate needed to communicate over SSL with your Azure Database for MySQL server from https://www.digicert.com/CACerts/BaltimoreCyberTrustRoot.crt.pem and save the certificate file to your local drive.

In this post, we’re using Azure Cloud Shell to connect to Microsoft Azure. So, we’ll upload the certificate to azure storage account.

Bg1643

2. Connect to the MySQL database on Azure with –ssl-ca parameter. If you using Azure PowerShell module to connect to Azure, let’s enter the local path of the downloaded certificate file.

Connect using Azure PowerShell:

mysql -h westus-mysql1.mysql.database.azure.com `
-u sqladmin@westus-mysql1 -p `
--ssl-ca=C:\Scripts\BaltimoreCyberTrustRoot.crt.pem

Connect using Azure Cloud Shell:

mysql -h westus-mysql1.mysql.database.azure.com `
-u sqladmin@westus-mysql1 -p `
--ssl-ca=BaltimoreCyberTrustRoot.crt.pem

Once done, you can see you’ve connected to the database. Let’s run status command to get the SSL configuration.

mysql -h westus-mysql1.mysql.database.azure.com -u sqladmin@westus-mysql1 -p --ssl-ca=BaltimoreCyberTrustRoot.crt.pem                    
Enter password:            
                
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MySQL connection id is 64428 
Server version: 5.6.47.0 MySQL Community Server (GPL)
                   
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MySQL [(none)]> status
--------------
/usr/bin/mysql  Ver 15.1 Distrib 10.3.34-MariaDB, for debian-linux-gnu (x86_64) using readline 5.2

Connection id:          64428
Current database:
Current user:           [email protected]
SSL:                    Cipher in use is ECDHE-RSA-AES256-GCM-SHA384
Current pager:          stdout
Using outfile:          ''
Using delimiter:        ;
Server:                 MySQL
Server version:         5.6.47.0 MySQL Community Server (GPL)
Protocol version:       10
Connection:             westus-mysql1.mysql.database.azure.com via TCP/IP
Server characterset:    latin1
Db     characterset:    latin1
Client characterset:    utf8mb4
Conn.  characterset:    utf8mb4
TCP port:               3306
Uptime:                 29 min 4 sec

Threads: 15  Questions: 816  Slow queries: 0  Opens: 55  Flush tables: 2  Open tables: 25  Queries per second avg: 0.467
--------------
ADVERTISEMENT
5/5 - (1 vote)
Previous Post

How to Create a MySQL Database on Azure With PowerShell

Next Post

Microsoft Azure The Subscription is Not Registered to Use Namespace

Related Posts

Ftr21

Export Microsoft 365 Disabled Users Report Using Microsoft Graph

December 7, 2023
Ftr22

Export List of Users with Managers Name and UPN in Microsoft 365

December 7, 2023
Ftr38

How to Split an Email Addresses From @ with PowerShell

December 5, 2023
Ftr38

[WinForms] Creating GUIs in Windows PowerShell with WinForms

November 15, 2023
Ftr21

Converting DateTime Obtained from Microsoft Graph Call to PowerShell Date and Time Format

October 21, 2023
Ftr21

How to Get Microsoft 365 License Expiration Dates using Graph Api

December 7, 2023

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Recent Posts

  • How to Enable Outlook Modern Authentication from Registry Setting
  • Export Microsoft 365 Disabled Users Report Using Microsoft Graph
  • Export List of Users with Managers Name and UPN in Microsoft 365

Categories

Stay in Touch

Discord Server

Join the Discord server with the site members for all questions and discussions.

Telegram Community

Jump in Telegram server. Ask questions and discuss everything with the site members.

Youtube Channel

Watch more videos, learning and sharing with Leo ❤❤❤. Sharing to be better.

Newsletter

Join the movement and receive our weekly Tech related newsletter. It’s Free.

General

Microsoft Windows

Microsoft Office

VMware

VirtualBox

Technology

PowerShell

Microsoft 365

Microsoft Teams

Email Servers

Copyright 2023 © All rights Reserved. Design by Leo with ❤

No Result
View All Result
  • Home
  • Linux
  • Intune
  • macOS
  • VMware
  • VirtualBox
  • Powershell
  • Windows 10
  • Windows 11
  • Microsoft 365
  • Microsoft Azure
  • Microsoft Office
  • Active Directory