DataFusion Server Usage Guide
GitHub Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Back to homepage

MySQL / MariaDB

Supported Versions

Configuration

Configuration File (config.toml)

Minimum example

[[databases]]
type = "mysql"
namespace = "my1"
user = "example"
password = "password"
host = "mysql-sever.local"
database = "example"

Full example

[[databases]]
type = "mysql"
namespace = "my1" # default mysql
user = "root"
password = "password"
host = "mysql-server.local"
port = 3306 # default 3306
database = "example"
ssl_mode = "preferred" # disabled (default), preferred(default 5.7.3+), required, verify-ca, verify-identity
max_connections = 30 # default 10
enable_schema_cache = true # default false
description = "MySQL / MariaDB"

By separating namespace, multiple definitions can be defined.

Environment Variables

Minimum example for docker run

docker run -d --rm \
    -p 4000:4000 \
    -e MYSQL_NAMESPACE=my1 \
    -e MYSQL_USER=example \
    -e MYSQL_PASSWORD=password \
    -e MYSQL_HOST=postgres.local \
    -e MYSQL_DATABASE=example \
    --name datafusion-server \
    datafusion-server:latest

In addition to this, the following parameters can be specified as needed.

  • MYSQL_PORT
  • MYSQL_SSL_MODE
  • MYSQL_MAX_CONNECTIONS
  • MYSQL_ENABLE_SCHEMA_CACHE

It can coexist with the configuration file, but namespace must be unique. Additionally, only one definition can be made via environment variables.