Skip to content

Latest commit

 

History

History
71 lines (50 loc) · 2.44 KB

use-mariadb.md

File metadata and controls

71 lines (50 loc) · 2.44 KB
title description ms.topic ms.date ms.custom
Use JavaScript on Azure MariaDB
To create or move your MariaDB database to Azure, you need a MariaDB resource.
include
08/08/2022
devx-track-js, devx-track-azurecli

Create an Azure Database for MariaDB resource

You can create a resource with:

[!INCLUDE Azure CLI commands]

View and use your MariaDB on Azure

While developing your MariaDB database with JavaScript, use one of the following tools:

Use SDK packages to develop your MariaDB on Azure

The Azure MariaDB uses npm packages already available, such as:

Use MariaDB SDK to connect to MariaDB on Azure

Note

This article contains references to the term slave, a term that Microsoft no longer uses. When the term is removed from the software, we’ll remove it from this article.

To connect and use your MariaDB on Azure with JavaScript, use the following procedure.

  1. Make sure Node.js and npm are installed.

  2. Create a Node.js project in a new folder:

    mkdir mariaDbDemo && \
        cd mariaDbDemo && \
        npm init -y && \
        npm install mariadb && \
        touch index.js && \
        code .

    The command:

    • creates a project folder named mariaDbDemo
    • changes the Bash terminal into that folder
    • initializes the project, which creates the package.json file
    • installs the mariadb npm package
    • creates the index.js script file
    • opens the project in Visual Studio Code
  3. Copy the following JavaScript code into index.js:

    :::code language="JavaScript" source="~/../js-e2e/database/mariadb/index.js" :::

  4. Replace the host, user, and password with your values in the script for your connection configuration object, config.

  5. Run the script.

MariaDB resources