SynthForge SynthForge SynthForge IO

Integration · MySQL · MariaDB

Generate MySQL test data, with foreign keys intact

Multi-table fixtures that load with mysql --local-infile=1 and import_mysql.sql. Free web sessions.

Short answer

Design a multi-table schema in SynthForge, generate, and download the MySQL export. You get import_mysql.sql (CREATE TABLE with FKs plus LOAD DATA LOCAL INFILE) and per-table CSVs. Every child row references a real parent by construction. Use --local-infile=1 so MySQL can read the CSVs from your machine. Everything lands in a synthforge_import database.

See the data

first_name last_name date_of_birth
Tammy Morrow 1969-08-30
Paul Pisacane 1913-10-03
Raymond Leung 1951-01-30
Hildreth Lowery 1918-05-10
Joseph Torres 1950-04-28
Robert Mote 1936-09-25
Kaylee Bean 2023-03-24
Marcella Noha 2010-03-17
Sierra Jenkins 2000-09-11
Monique McGreevy 2006-08-16
Reese Blair 2016-01-18
Montana Friel 2004-05-09

Person names follow US Census and SSA frequencies. First names match birth year on the same row.

Download sample pack customers, products, orders, order_items · SQL + CSV · No signup required

Try these after you load the pack

sql · orphan check (expect 0)
SELECT COUNT(*) AS orphan_orders
FROM orders o
LEFT JOIN customers c ON o.customer_id = c.customer_id
WHERE c.customer_id IS NULL;
sql · top surnames
SELECT last_name, COUNT(*) AS n,
       ROUND(100.0 * COUNT(*) / SUM(COUNT(*)) OVER (), 3) AS pct
FROM customers
GROUP BY last_name
ORDER BY n DESC
LIMIT 10;
sql · 1950s first-name cohort
SELECT first_name, COUNT(*) AS n
FROM customers
WHERE YEAR(date_of_birth) BETWEEN 1950 AND 1959
GROUP BY first_name
ORDER BY n DESC
LIMIT 10;

Why generate rather than hand-roll

Laravel, WordPress-adjacent apps, and plenty of cloud MySQL staging DBs still need multi-table seed data. Hand-written Faker scripts break foreign keys; repair becomes the job.

SynthForge sorts tables by dependency, generates parents first, and samples FKs from IDs that exist. The same schema can also export to Postgres or DuckDB when your stack mixes engines.

How to do it

1. Define the schema

Describe tables in plain English, build them in the visual editor, or paste CREATE TABLE DDL. AI forge and SQL import both produce multi-table schemas with single-column foreign keys.

2. Set cardinality (optional)

Use relationship ratios such as "1 to 4 orders per customer" instead of inventing every child row count. Parents generate first; child foreign keys are sampled from real parent IDs.

3. Generate and export MySQL

Pick MySQL as the SQL dialect (or include SQL export in formats). The download ZIP contains import_mysql.sql (CREATE TABLE with FKs declared inline, plus LOAD DATA LOCAL INFILE loaders) and csv/<table>.csv data files. The script creates a synthforge_import database and loads into that, so it cannot disturb a database you already have. MariaDB gets the same pattern via import_mariadb.sql.

4. Enable LOCAL INFILE, then load

MySQL 8+ often disables local_infile on client and server. The import script header documents the fix. Extract the ZIP, cd into the folder so csv/ paths resolve, then run. You do not need to create a database first: the script creates synthforge_import and loads into that, which is why there is no database name on the command below.

bash
# Allow client-side CSV load (MySQL 8+ often needs both)
# Server (once, if ERROR 3948 / local data disabled):
#   mysql -u root -p -e "SET GLOBAL local_infile = 1;"

mysql -u user -p --local-infile=1 < import_mysql.sql

# Everything lands in the synthforge_import database:
#   mysql -u user -p -e "SELECT COUNT(*) FROM synthforge_import.customers"
#
# Want it somewhere else? Find and replace synthforge_import in
# the script before running it.

# Loaders look like:
#   LOAD DATA LOCAL INFILE 'csv/customers.csv'
#   INTO TABLE customers
#   FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' ESCAPED BY ''
#   ...

5. (Optional) Agent path

With an API key and hosted MCP, agents can run description_to_dataset, download the ZIP, and you still load with import_mysql.sql. First API key includes 250 free credits; web sessions stay free.

text
# MCP endpoint: https://mcp.synthforge.io/mcp
# Auth: Authorization: Bearer sfk_live_…
# Docs: https://synthforge.io/docs/mcp

Frequently asked questions

Why do I need --local-infile=1?
LOAD DATA LOCAL INFILE streams CSVs from your machine into the server. MySQL 8+ disables that by default (ERROR 3948). Use --local-infile=1 on the client, and if needed SET GLOBAL local_infile = 1 on the server. The import_mysql.sql header documents both steps.
Does MySQL enforce the foreign keys?
Yes, when you use InnoDB tables with FOREIGN KEY constraints. SynthForge emits FK-aware CREATE TABLE for MySQL, and the data is also referentially valid by construction: child keys are drawn from generated parent IDs.
Does this work with MariaDB or cloud MySQL?
MariaDB: use the MariaDB dialect export (import_mariadb.sql) with the same --local-infile pattern. Managed MySQL: as long as the client can LOCAL INFILE and your user is allowed, the same script works. Some managed hosts restrict LOCAL INFILE; in that case load CSVs with your provider's import tool or use a temporary bastion with local_infile enabled.
How large a dataset can I generate?
Up to 1,000,000 rows per table and 1,000,000 rows per dataset, plus a 200 MB cap on the generated download and per-account rate limits. The download cap is what binds on wide, text-heavy tables: 25 columns including free text reaches 200 MB at roughly 575,000 rows. A typical 15-column table generates 200,000 rows in about 12 seconds.
Can I use the same schema for Postgres or DuckDB?
Yes. One schema exports to PostgreSQL, MySQL, SQLite, SQL Server, MariaDB, DuckDB, and CockroachDB, plus CSV, JSON, JSONL, and Parquet.
Does SynthForge use my real production data?
No. It generates greenfield data from the schema you provide. It does not ingest or de-identify a live database. For anonymizing real data, use tools like Tonic or NVIDIA NeMo.

Related

Ready to seed MySQL staging?

Generate multi-table MySQL data with real foreign keys, then load with one mysql command. No credit card for the web app.