Azure Database for MySQL Client Libraries

Connect to and manage your Azure Database for MySQL instances using a variety of programming languages. These client libraries provide the tools you need to interact with your database from your applications.

Supported Languages

We offer robust SDKs and libraries for the most popular development languages. Choose the one that best fits your application stack:

Python Logo

Python

Java Logo

Java

Node.js Logo

Node.js

.NET Logo

.NET

PHP Logo

PHP

Go Logo

Go

Getting Started

Each language library comes with comprehensive documentation, examples, and quickstart guides. Below are links to the primary reference documentation for each language:

  • Python: Explore the official Python SDK for Azure Database for MySQL. Learn how to connect, execute queries, and manage your database.
    pip install azure-mgmt-rdbms-mysql mysql-connector-python
    Python Reference & Examples
  • Java: Integrate Azure Database for MySQL seamlessly with your Java applications using the Azure SDK for Java.
    <dependency>
        <groupId>com.azure.resourcemanager</groupId>
        <artifactId>azure-resourcemanager-mysql</artifactId>
        <version>YOUR_VERSION</version>
    </dependency>
    <dependency>
        <groupId>mysql</groupId>
        <artifactId>mysql-connector-java</artifactId>
        <version>YOUR_VERSION</version>
    </dependency>
    Java Reference & Examples
  • Node.js: Utilize the Azure SDK for JavaScript to manage and interact with your MySQL database from Node.js applications.
    npm install @azure/arm-mysql @azure/mysql-query
    Node.js Reference & Examples
  • .NET: Leverage the Azure SDK for .NET to build powerful applications with Azure Database for MySQL.
    Install-Package Microsoft.Azure.Management.Mysql -Version 1.0.0
    Install-Package MySql.Data -Version 8.0.28
    .NET Reference & Examples
  • PHP: Connect to your Azure Database for MySQL from PHP applications using the recommended drivers and libraries.
    composer require microsoft/azure-sdk-for-php
    composer require mysql/mysql-connector-php
    PHP Reference & Examples
  • Go: Integrate Azure Database for MySQL into your Go applications with the Azure SDK for Go.
    go get github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mysql/armmysql
    go get github.com/go-sql-driver/mysql
    Go Reference & Examples

Key Features

  • Connection Management: Secure and efficient connection pooling to your MySQL instances.
  • Query Execution: Execute SQL queries with ease, including parameterized queries to prevent injection attacks.
  • Data Manipulation: Perform CRUD (Create, Read, Update, Delete) operations on your database tables.
  • Transaction Support: Manage transactions for data integrity.
  • Error Handling: Robust error handling mechanisms for graceful failure management.
  • Azure Resource Management: (For management libraries) Create, configure, and manage MySQL server instances and related resources programmatically.

Best Practices

  • Always use parameterized queries to enhance security.
  • Implement connection pooling to optimize performance.
  • Handle potential exceptions and errors gracefully.
  • Keep your client libraries updated to the latest versions for security and feature improvements.
  • Refer to the specific language's documentation for detailed guidance on authentication, configuration, and advanced features.

For detailed API references, code samples, and tutorials specific to each language, please refer to the respective sections below.

Python

The Python SDK for Azure Database for MySQL allows you to manage your resources and interact with your data.

Python SDK Documentation Python Quickstart

Java

Leverage the Azure SDK for Java to build enterprise-grade applications with Azure Database for MySQL.

Java SDK Documentation Java Quickstart

Node.js

Manage and access your Azure Database for MySQL from your Node.js backend.

Node.js SDK Documentation Node.js Quickstart

.NET

Integrate Azure Database for MySQL into your .NET applications seamlessly.

.NET SDK Documentation .NET Quickstart

PHP

Connect and manage your MySQL database from PHP applications.

PHP SDK Documentation PHP Quickstart

Go

Build robust applications with Go and Azure Database for MySQL.

Go SDK Documentation Go Quickstart