Skip to content

Commit 3e20e87

Browse files
Merge pull request #235119 from divargas-msft/patch-7
[Doc-a-thon] Updating howto-configure-ssl.md
2 parents 18ab52c + 8ab83e8 commit 3e20e87

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

articles/mariadb/howto-configure-ssl.md

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ ms.service: mariadb
55
author: savjani
66
ms.author: pariks
77
ms.topic: how-to
8-
ms.date: 06/24/2022
8+
ms.date: 04/19/2023
99
ms.devlang: csharp, golang, java, php, python, ruby
1010
ms.custom: devx-track-csharp
1111
---
@@ -40,7 +40,7 @@ For existing connections, you can bind SSL by right-clicking on the connection i
4040

4141
Another way to bind the SSL certificate is to use the MySQL command-line interface by executing the following commands.
4242

43-
```bash
43+
```terminal
4444
mysql.exe -h mydemoserver.mariadb.database.azure.com -u Username@mydemoserver -p --ssl-mode=REQUIRED --ssl-ca=c:\ssl\BaltimoreCyberTrustRoot.crt.pem
4545
```
4646

@@ -57,16 +57,19 @@ Using the Azure portal, visit your Azure Database for MariaDB server, and then s
5757
### Using Azure CLI
5858

5959
You can enable or disable the **ssl-enforcement** parameter by using Enabled or Disabled values respectively in Azure CLI.
60+
6061
```azurecli-interactive
6162
az mariadb server update --resource-group myresource --name mydemoserver --ssl-enforcement Enabled
6263
```
6364

6465
## Verify the SSL connection
6566

6667
Execute the mysql **status** command to verify that you have connected to your MariaDB server using SSL:
68+
6769
```sql
6870
status
6971
```
72+
7073
Confirm the connection is encrypted by reviewing the output, which should show: **SSL: Cipher in use is AES256-SHA**
7174

7275
## Sample code
@@ -83,6 +86,7 @@ if (mysqli_connect_errno($conn)) {
8386
die('Failed to connect to MySQL: '.mysqli_connect_error());
8487
}
8588
```
89+
8690
### Python (MySQLConnector Python)
8791

8892
```python
@@ -95,6 +99,7 @@ try:
9599
except mysql.connector.Error as err:
96100
print(err)
97101
```
102+
98103
### Python (PyMySQL)
99104

100105
```python
@@ -117,6 +122,7 @@ client = Mysql2::Client.new(
117122
:ssl_mode => 'required'
118123
)
119124
```
125+
120126
#### Ruby on Rails
121127

122128
```ruby
@@ -142,6 +148,7 @@ var connectionString string
142148
connectionString = fmt.Sprintf("%s:%s@tcp(%s:3306)/%s?allowNativePasswords=true&tls=custom",'myadmin@mydemoserver' , 'yourpassword', 'mydemoserver.mariadb.database.azure.com', 'quickstartdb')
143149
db, _ := sql.Open("mysql", connectionString)
144150
```
151+
145152
### Java (JDBC)
146153

147154
```java
@@ -172,6 +179,7 @@ properties.setProperty("user", 'myadmin@mydemoserver');
172179
properties.setProperty("password", 'yourpassword');
173180
conn = DriverManager.getConnection(url, properties);
174181
```
182+
175183
### Java (MariaDB)
176184

177185
```java

0 commit comments

Comments
 (0)