Quickstart: Get started with Azure Database for MariaDB
Prerequisites
Make sure you have the following before you begin:
- An Azure account – Free trial available.
- Azure CLI installed (
az
version 2.30+). - MySQL client (e.g.,
mysql
command‑line tool). - Git installed if you plan to clone the sample repository.
1. Create a MariaDB server
Run the following Azure CLI commands to create a resource group and a MariaDB server.
az group create --name myResourceGroup --location eastus
az mariadb server create \
--resource-group myResourceGroup \
--name mymariadbserver \
--location eastus \
--admin-user myadmin \
--admin-password MySuperSecret123 \
--sku-name B_Gen5_2 \
--version 10.5
2. Configure firewall rules
Allow your client IP to connect to the server.
MY_IP=$(curl -s https://ifconfig.me)
az mariadb server firewall-rule create \
--resource-group myResourceGroup \
--server-name mymariadbserver \
--name AllowMyIP \
--start-ip-address $MY_IP \
--end-ip-address $MY_IP
3. Connect with the MySQL client
Use the mysql
client to verify connectivity.
mysql -h mymariadbserver.mariadb.database.azure.com -u myadmin@mymariadbserver -p
4. Deploy a sample Node.js app
Clone the sample repo and run the app.
git clone https://github.com/Azure-Samples/mariadb-nodejs-getting-started.git
cd mariadb-nodejs-getting-started
npm install
# Update .env with your server name, admin user, and password
cp .env.example .env
# Edit .env accordingly
npm start