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.
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 plus LOAD DATA LOCAL INFILE loaders) and csv/<table>.csv data files. 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:
# 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 -e "CREATE DATABASE myapp_staging"
mysql -u user -p --local-infile=1 myapp_staging < import_mysql.sql
# 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 10 free credits; web sessions stay free.
# 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?
Does MySQL enforce the foreign keys?
Does this work with MariaDB or cloud MySQL?
How large a dataset can I generate?
Can I use the same schema for Postgres or DuckDB?
Does SynthForge use my real production data?
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.