MySQL

Datafly Signal writes first-party events into a MySQL table for high-performance relational storage with JSON column support and broad ecosystem compatibility.

Prerequisites

Before configuring MySQL in Signal, you need a MySQL server (self-hosted or managed), a database and table, and a user with INSERT privileges.

Set Up a MySQL Server

You have several options:

Option A: Managed MySQL

Option B: Self-Hosted MySQL

  1. Install MySQL using the official guide.
  2. Start the MySQL server.
  3. Ensure the server is accessible from your Signal infrastructure on port 3306.

Configure Network Access

Ensure your MySQL server accepts connections from Signal’s IP addresses:

  • RDS: Configure the security group inbound rules.
  • Azure: Add firewall rules in the Networking tab.
  • Cloud SQL: Add authorised networks.
  • Self-hosted: Configure the bind-address in my.cnf and firewall rules.

Create a Database and Table

Connect to the MySQL server and create the target database and table:

CREATE DATABASE datafly_events;
 
USE datafly_events;
 
CREATE TABLE events (
  event_id VARCHAR(64) NOT NULL PRIMARY KEY,
  type VARCHAR(20),
  event VARCHAR(256),
  anonymous_id VARCHAR(64),
  user_id VARCHAR(256),
  timestamp DATETIME(3),
  received_at DATETIME(3),
  sent_at DATETIME(3),
  context JSON,
  properties JSON,
  traits JSON,
  source_id VARCHAR(64),
  integration_id VARCHAR(64),
  INDEX idx_timestamp (timestamp DESC),
  INDEX idx_type_event (type, event)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

Using utf8mb4 character set ensures full Unicode support. The JSON column type allows flexible querying with MySQL’s JSON functions (e.g. JSON_EXTRACT, ->).

Create a User for Signal

CREATE USER 'datafly_signal'@'%' IDENTIFIED BY 'your_secure_password';
GRANT INSERT ON datafly_events.events TO 'datafly_signal'@'%';
FLUSH PRIVILEGES;
⚠️

Replace '%' with Signal’s specific IP address or CIDR range for tighter security. The % wildcard allows connection from any host.

Configuration

FieldTypeRequiredDescription
hoststringYesThe MySQL server hostname.
portstringYesThe MySQL server port. Defaults to 3306.
databasestringYesThe target database name.
table_namestringYesThe target table name to insert rows into.
usernamestringYesThe database username for authentication.
passwordsecretYesThe database password for authentication.
tls_modeselectNoTLS mode: disabled, preferred, required, verify-ca, or verify-identity. Defaults to preferred. Also accepts the legacy use_tls boolean.

Signal Setup

Quick Setup

  1. Navigate to Integrations in the sidebar.
  2. Open the Integration Library tab.
  3. Find MySQL or filter by Database.
  4. Click Install, select a variant if available, and fill in the required fields.
  5. Click Install Integration to create the integration with a ready-to-use default blueprint.

API Setup

curl -X POST http://localhost:8084/v1/admin/integration-catalog/mysql/install \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "MySQL",
    "variant": "default",
    "config": {
      "host": "db.example.com",
      "port": "3306",
      "database": "datafly_events",
      "table_name": "events",
      "username": "datafly_signal",
      "password": "your_secure_password",
      "tls_mode": "required"
    },
    "delivery_mode": "server_side"
  }'

Schema

Signal writes the standard event envelope. The recommended table definition:

ColumnMySQL typeNotes
event_idVARCHAR(64) NOT NULL PRIMARY KEYUnique per event.
typeVARCHAR(20)Event type.
eventVARCHAR(256)Event name (snake_case).
anonymous_idVARCHAR(64)First-party visitor identifier.
user_idVARCHAR(256)Logged-in user identifier (nullable).
timestampDATETIME(3)Client event time, millisecond precision.
received_atDATETIME(3)Time Signal received the event.
sent_atDATETIME(3)Time the row was delivered.
contextJSONPage, device, user agent, consent metadata.
propertiesJSONCustom event properties.
traitsJSONUser traits.
source_idVARCHAR(64)Pipeline source identifier.
integration_idVARCHAR(64)Signal integration identifier.

Query JSON columns with JSON_EXTRACT() or the -> / ->> operators (MySQL 5.7+).

MySQL is a first-party destination under your control. The default blueprint forwards all events. Apply consent filtering via pipeline transforms or downstream views over context->'$.consent' if needed.

Testing

  1. Enable the integration in Signal and trigger a test event on your website.
  2. Connect to the MySQL server and query the target table:
SELECT * FROM datafly_events.events ORDER BY timestamp DESC LIMIT 10;
  1. Verify that event rows are appearing with correct data.
  2. In Signal, check the Live Events view to confirm delivery status shows as successful.

Troubleshooting

ProblemSolution
Events not appearing in the tableVerify the host, port, database, and table name are correct.
Connection refused / timeoutCheck that the MySQL server accepts connections from Signal’s IP. Verify firewall rules, security groups, or authorised networks.
Access denied for userThe username or password is incorrect, or the user cannot connect from Signal’s IP. Verify credentials and user host restriction.
INSERT command deniedThe user lacks INSERT privilege. Run GRANT INSERT ON db.table TO 'user'@'%';.
Table doesn't existThe table does not exist in the specified database. Verify the database and table names.
TLS connection errorsIf use_tls is true, ensure the MySQL server has SSL enabled. For managed services, SSL is typically enabled by default.
Data too long for columnAn event field exceeds the column’s VARCHAR length. Increase the column size or check the data.
Character encoding issuesEnsure the table uses utf8mb4 character set and the connection character set matches.

Visit MySQL documentation for full SQL reference, performance tuning, and replication setup.

See also