> ## Documentation Index
> Fetch the complete documentation index at: https://vexidata.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# MariaDB

> Connect your MariaDB database to VexiData.

<Tip>
  If you're using a managed MariaDB service, check our provider-specific guides for step-by-step instructions tailored to your platform:

  <CardGroup cols={3}>
    <Card title="AWS RDS" icon="https://mintcdn.com/mtsdigitalventuressrl/9yUap0SLGrotT8se/images/data-source-connections/aws.svg?fit=max&auto=format&n=9yUap0SLGrotT8se&q=85&s=ec0bac54f9403a756fcee3551b59afec" href="/providers/aws-rds" width="16" height="16" data-path="images/data-source-connections/aws.svg" />

    <Card title="Google Cloud SQL" icon="https://mintcdn.com/mtsdigitalventuressrl/9yUap0SLGrotT8se/images/data-source-connections/google-cloud-sql.svg?fit=max&auto=format&n=9yUap0SLGrotT8se&q=85&s=6402c46f70abeb5c75640caac469d4dc" href="/providers/google-cloud-sql" width="512" height="512" data-path="images/data-source-connections/google-cloud-sql.svg" />

    <Card title="Aiven" icon="https://mintcdn.com/mtsdigitalventuressrl/9yUap0SLGrotT8se/images/data-source-connections/aiven.svg?fit=max&auto=format&n=9yUap0SLGrotT8se&q=85&s=6fa81839f8196d019b6dafaeec94ce84" href="/providers/aiven" width="42" height="36" data-path="images/data-source-connections/aiven.svg" />

    <Card title="Heroku" icon="https://mintcdn.com/mtsdigitalventuressrl/7jtPliLLIO4gCxrB/images/data-source-connections/heroku.svg?fit=max&auto=format&n=7jtPliLLIO4gCxrB&q=85&s=b21e860aececda6372e84399a5a04527" href="/providers/heroku" width="800" height="800" data-path="images/data-source-connections/heroku.svg" />

    <Card title="OVHcloud" icon="https://mintcdn.com/mtsdigitalventuressrl/7jtPliLLIO4gCxrB/images/data-source-connections/ovh.svg?fit=max&auto=format&n=7jtPliLLIO4gCxrB&q=85&s=b431da5df8cda41e3e710c101b07b0ac" href="/providers/ovhcloud" width="65" height="65" data-path="images/data-source-connections/ovh.svg" />

    <Card title="MariaDB Cloud" icon="https://mintcdn.com/mtsdigitalventuressrl/7jtPliLLIO4gCxrB/images/data-source-connections/mariadb.svg?fit=max&auto=format&n=7jtPliLLIO4gCxrB&q=85&s=c9bf6d7e2fba5434cc5cd0dabb9c6132" href="/providers/mariadb-cloud" width="800" height="800" data-path="images/data-source-connections/mariadb.svg" />
  </CardGroup>
</Tip>

## Prerequisites

* A MariaDB database (version 10.2 or later recommended) that is accessible over the network
* The database host, port, name, username, and password
* A [VexiData](https://vexidata.com) account

## Connect MariaDB to VexiData

<Steps>
  <Step title="Gather your connection details">
    You need five pieces of information to connect. If you set up MariaDB yourself, you'll already know these. If someone else manages the database, ask your database administrator.

    | Parameter    | Description                                       | Default     |
    | ------------ | ------------------------------------------------- | ----------- |
    | **Host**     | The hostname or IP address of your MariaDB server | `localhost` |
    | **Port**     | The port MariaDB is listening on                  | `3306`      |
    | **Database** | The name of the database you want to query        | —           |
    | **Username** | A MariaDB user with access to the database        | `root`      |
    | **Password** | The password for that user                        | —           |
  </Step>

  <Step title="Allow VexiData through your firewall (if applicable)">
    If your MariaDB server is behind a firewall or only accepts connections from specific IPs, add VexiData's IP addresses:

    * `46.101.71.122`

    **Common places to configure this:**

    * **Cloud VMs** (AWS EC2, DigitalOcean Droplets, GCP Compute) — Security Groups or firewall rules
    * **Self-hosted servers** — Your OS firewall (e.g., `ufw`, `iptables`)
    * **Managed databases** — See the provider-specific guides linked above

    <Info>
      If your database is only accessible from `localhost` or a private network, you'll need to either expose it to the internet or set up an SSH tunnel. VexiData requires a direct TCP connection to your database.
    </Info>
  </Step>

  <Step title="Verify MariaDB accepts remote connections">
    By default, MariaDB may only listen on `localhost`. If your database is on a remote server, make sure it's configured to accept external connections:

    1. In your MariaDB configuration file (`my.cnf` or `my.ini`), set:

    ```ini theme={null}
    [mysqld]
    bind-address = 0.0.0.0
    ```

    2. Restart MariaDB for the change to take effect.

    3. Verify your MariaDB user is allowed to connect from remote hosts. Users created with `'localhost'` can only connect locally:

    ```sql theme={null}
    -- Check if your user allows remote connections
    SELECT user, host FROM mysql.user WHERE user = 'your_username';
    ```

    If the `host` column shows `localhost` or `127.0.0.1`, you'll need to create a user that allows remote access (see the read-only user section below).

    <Info>
      Managed database services (AWS RDS, Google Cloud SQL, etc.) handle this automatically. You only need this step for self-hosted MariaDB.
    </Info>
  </Step>

  <Step title="Add the connection in VexiData">
    1. Go to [Data Sources](https://vexidata.com/data-sources) in VexiData
    2. Click **MariaDB** to open the connection form
    3. Fill in the details:

    | Field            | Value                                                      |
    | ---------------- | ---------------------------------------------------------- |
    | **Display Name** | A name to identify this connection (e.g., "Production DB") |
    | **Host**         | Your server's hostname or IP address                       |
    | **Port**         | `3306` (or your custom port)                               |
    | **Database**     | Your database name                                         |
    | **Username**     | Your MariaDB username                                      |
    | **Password**     | Your MariaDB password                                      |
  </Step>

  <Step title="Test and save">
    Click **Test & Save Connection**. VexiData will verify it can reach your database. Once connected, your schema will be analyzed automatically.
  </Step>
</Steps>

## Creating a read-only user (recommended)

For security, we recommend connecting VexiData with a dedicated read-only user instead of your admin or application user. This ensures VexiData can only read data, never modify it.

```sql theme={null}
-- Create the user (% allows connections from any host)
CREATE USER 'vexidata'@'%' IDENTIFIED BY 'your-secure-password';

-- Grant read-only access to your database
GRANT SELECT ON your_database.* TO 'vexidata'@'%';

-- Apply the changes
FLUSH PRIVILEGES;
```

To restrict access to specific tables instead of the entire database:

```sql theme={null}
GRANT SELECT ON your_database.orders TO 'vexidata'@'%';
GRANT SELECT ON your_database.customers TO 'vexidata'@'%';
FLUSH PRIVILEGES;
```

## Troubleshooting

<AccordionGroup>
  <Accordion title="Connection timed out">
    This means VexiData can't reach your server. Check:

    * Your firewall allows inbound connections on port `3306` from VexiData's IPs
    * `bind-address` in your MariaDB config is set to `0.0.0.0` (not `127.0.0.1`)
    * Your server has a public IP or hostname that resolves correctly
    * If on a cloud VM, the Security Group / firewall rules allow traffic on port `3306`
  </Accordion>

  <Accordion title="Authentication failed">
    * Verify the username and password are correct
    * Check that the MariaDB user allows connections from remote hosts. Run `SELECT user, host FROM mysql.user;` to see allowed hosts — if it shows `localhost`, the user can't connect remotely
    * Create a user with `'%'` as the host to allow connections from any IP: `CREATE USER 'user'@'%' IDENTIFIED BY 'password';`
  </Accordion>

  <Accordion title="Access denied for database">
    * The MariaDB user might not have permissions on the specified database. Grant access with: `GRANT SELECT ON your_database.* TO 'user'@'%';`
    * Run `SHOW GRANTS FOR 'your_user'@'%';` to verify current permissions
  </Accordion>

  <Accordion title="No tables visible after connecting">
    * Check that your user has `SELECT` permissions on the tables in the database
    * Verify you entered the correct database name — MariaDB database names are case-sensitive on Linux
    * Run `SHOW TABLES;` in the MariaDB CLI to confirm tables exist in the database
  </Accordion>

  <Accordion title="SSL connection errors">
    * If your server requires SSL, VexiData will attempt SSL automatically
    * For self-hosted servers, ensure MariaDB SSL is properly configured with valid certificates
    * Check that `require_secure_transport` is set correctly in your MariaDB config
  </Accordion>
</AccordionGroup>
