MySQL Adapter

April 10, 2025

Deprecated Feature

@c15t/backend v1 did not deliver the flexibility we wanted and fell short of our standards. It is now deprecated as we work on a full rewrite, with v2 entering canary soon. This does not affect consent.io deployments, which remain stable.

Installation

Install the MySQL adapter and its dependencies:

Configuration

Configure the MySQL adapter with your connection details:

Schema Management

Initialize your database schema:

Usage Examples

Basic CRUD Operations

Transactions

Advanced Queries

Using MySQL-Specific Features

Performance Optimization

Best Practices

  • Use InnoDB tables for transactions and foreign key support
  • Set appropriate character sets (utf8mb4 recommended for full Unicode support)
  • Configure connection pooling for efficient resource management
  • Create proper indexes on frequently queried columns
  • Use prepared statements to prevent SQL injection (handled automatically)
  • Consider table partitioning for very large tables
  • Regularly optimize tables for performance maintenance

Monitoring and Management

Limitations

  • JSON support is less powerful than PostgreSQL (especially in MySQL 5.7)
  • Requires a running MySQL/MariaDB server
  • Default isolation level may differ from other databases
  • Some ALTER TABLE operations require table rebuilds