# Integrate MariaDB with Databox

MariaDB is an open-source relational database management system and a community-maintained fork of MySQL, created by MySQL's original developers. It is wire-compatible with MySQL and is commonly self-hosted on Linux servers or deployed through cloud platforms such as AWS, Google Cloud, and DigitalOcean. Connecting MariaDB to Databox lets you pull data directly from your database, build datasets using SQL queries, and visualize business-critical figures alongside data from your other connected tools.

## Connection

If you've already established a connection, you can [reuse](/add-a-data-source) it to add new data sources to your Databox account.

### Step 1: Create a read-only MariaDB user for Databox

Databox only reads data from your database — it never writes to it. Create a dedicated user with `SELECT`-only privileges scoped to the Databox IP address. Connect to your MariaDB server as an administrative user and run the following commands.


```sql
CREATE USER 'databox'@'52.4.198.118' IDENTIFIED BY 'your_secure_password';
GRANT SELECT ON your_database.* TO 'databox'@'52.4.198.118';
FLUSH PRIVILEGES;
```

Replace `your_database` with the name of the database you want to connect, and `your_secure_password` with a strong password. If you need to grant access to multiple databases, repeat the `GRANT` statement for each one.

Avoid the following special characters in your password, as they can cause encoding issues when establishing the connection: ```, `'`, `"`, `/`, `\`, and spaces.

### Step 2: Allow remote connections on your MariaDB server

By default, MariaDB binds only to `127.0.0.1` and does not accept connections from remote hosts. To allow Databox to connect, update the `bind-address` setting in your MariaDB configuration file.

1. Open your MariaDB configuration file. The location varies by distribution:
  - Debian/Ubuntu: `/etc/mysql/mariadb.conf.d/50-server.cnf`
  - RHEL/CentOS/Fedora: `/etc/my.cnf` or `/etc/my.cnf.d/mariadb-server.cnf`
2. Find the `bind-address` line and change its value:

```ini
bind-address = 0.0.0.0
```
3. Save the file and restart MariaDB:

```bash
sudo systemctl restart mariadb
```


If you prefer not to change `bind-address` globally, you can set it to your server's specific public IP address instead of `0.0.0.0`. Databox will still be able to connect as long as the IP is reachable and the firewall rule from [Step 3](#step-3-open-port-3306-in-your-server-firewall) is in place.

### Step 3: Open port 3306 in your server firewall

Allow inbound TCP traffic on port `3306` from the Databox IP address. The command depends on which firewall tool your server uses.

**UFW (Debian/Ubuntu):**


```bash
sudo ufw allow from 52.4.198.118 to any port 3306 proto tcp
sudo ufw reload
```

**firewalld (RHEL/CentOS/Fedora):**


```bash
sudo firewall-cmd --permanent --add-rich-rule='rule family="ipv4" source address="52.4.198.118/32" port protocol="tcp" port="3306" accept'
sudo firewall-cmd --reload
```

**iptables:**


```bash
sudo iptables -A INPUT -p tcp -s 52.4.198.118 --dport 3306 -j ACCEPT
```

If your server runs on a cloud provider (AWS, Google Cloud, Azure, DigitalOcean, etc.), you must also open port `3306` in the provider's network-level firewall — such as a VPC security group, firewall rule, or network access control list — in addition to the OS-level firewall above.

### Step 4: Enter your MariaDB connection details in Databox

1. In Databox, go to **Data Sources > + New connection**.
2. Search for **MariaDB** and click **Connect**.
3. Fill in the connection form:
  - **Data source name** — a label for this connection in Databox.
  - **Host** — the public IP address or hostname of your MariaDB server (e.g., `203.0.113.42` or `db.example.com`).
  - **Port** — the port MariaDB listens on. The default is `3306`.
  - **User** — the MariaDB username created in [Step 1](#step-1-create-a-read-only-mariadb-user-for-databox).
  - **Password** — the password for that user.
  - **Database name** (optional) — the specific database to connect to. Leave blank to connect at the server level.
  - **Timezone** — the time zone used to interpret date values in query results. Defaults to `Etc/UTC`.
4. Select an **SSL/TLS mode** (see [SSL/TLS](#ssltls) below).
5. Click **Connect**.


connect
## SSL/TLS

Databox offers three SSL/TLS modes when connecting to a database. Choose the one that matches your server's configuration.

| Mode | Description |
|  --- | --- |
| None | The connection is made without SSL/TLS encryption. Use this only when your server does not have SSL enabled. |
| Use SSL/TLS with provider CA bundle | The connection uses SSL/TLS and authenticates the server using a regional CA bundle managed by your cloud provider (for example, Amazon RDS). When you check **Verify server certificate using regional CA bundle**, an additional **CA certificate bundle (ssl-ca)** field appears, where you can paste your provider's CA certificate. |
| Use SSL/TLS with custom certificates | The connection uses SSL/TLS with certificates you supply directly. When **Verify server certificate** is checked, you must provide a **CA certificate (ssl-ca)**. You may also supply a **Client certificate (ssl-cert)** and **Client private key (ssl-key)** for mutual TLS. If **Verify server certificate** is unchecked, only the client certificate and private key fields are shown. |


MariaDB supports SSL/TLS connections using certificates you manage on the server. To use SSL with server certificate verification, copy the contents of the CA certificate used to sign your MariaDB server's certificate and paste it into the **CA certificate bundle (ssl-ca)** field in Databox. On a self-managed server, the CA certificate is typically located at `/etc/mysql/ssl/ca-cert.pem` or a path configured in your MariaDB server settings. For step-by-step instructions on configuring each SSL mode, see [Enable SSL/TLS for your database connection](/enable-ssl-tls-for-your-database-connection).

## Datasets

The MariaDB integration supports the creation of [datasets](/understanding-datasets), which allow you to define and shape the specific data you want to use for reporting in Databox. Datasets make it easier to focus on the most relevant information, enabling you to filter, visualize, and analyze metrics across projects, teams, and clients without writing complex queries each time.

### Steps to create a dataset

1. **Select a table**: Pick the appropriate schema within that database.
2. **Select columns**: Browse and select the specific columns (fields) from your tables or views to include in your dataset. These columns define the structure and content of your dataset.


### Optional: Write SQL

For more advanced use cases, you can write a **custom SQL query** instead of selecting columns manually. This allows you to:

- Join multiple tables
- Apply filters and aggregations
- Format or transform data before importing it into Databox


Your query must return a valid tabular result to be used as a dataset.

### Additional resources

- [MariaDB documentation](https://mariadb.com/kb/en/documentation/) — Official MariaDB Knowledge Base, covering installation, configuration, user management, replication, storage engines, and security.
- [MariaDB account management](https://mariadb.com/kb/en/account-management-sql-commands/) — Reference for `CREATE USER`, `GRANT`, and related SQL commands used to manage database users and privileges.


## Resources

For comprehensive details on metrics, data availability, templates, specifications, usage guidelines, and other key information, refer to the resources listed below.

Yes. Cloud providers maintain a network-level firewall separate from your OS firewall. In addition to the OS-level firewall rule in [Step 3](#step-3-open-port-3306-in-your-server-firewall), you must add an inbound rule allowing TCP on port `3306` from `52.4.198.118` in your provider's console — for example, an AWS VPC security group, a Google Cloud firewall rule, or an Azure network security group.

Check the following in order:

1. `bind-address` in the MariaDB configuration is set to `0.0.0.0` (or your server's public IP), and MariaDB has been restarted since the change.
2. The OS-level firewall allows TCP on port `3306` from `52.4.198.118`.
3. Any cloud provider network firewall also allows port `3306` from `52.4.198.118/32`.
4. The MariaDB user was created with `'databox'@'52.4.198.118'` as the host — not `'%'` or `'localhost'`. Run `FLUSH PRIVILEGES;` after any user or grant changes.


 

Ask Genie
Get instant answers or help with your data using the in-app AI assistant.

Talk to an expert
For customers: Get help with your setup, strategy, or making the most of Databox.

Book a demo
New to Databox? See how it works and get guidance on getting started.

Send an email
Reach out to support for help with your account, data, or technical issues.