MySQL Random Data Generator

MySQL Random Data Generator is a tool for developers and DBAs to generate test data for MySQL databases. Generate SQL INSERT statements from an existing CREATE TABLE statement, populate a MySQL table directly, or generate test data from the command line. It is useful for development, testing, query testing, database migrations, replication testing, and performance testing.

Developer API

Integrate data generation into your CI/CD or scripts.

API Documentation
Disclaimer

This tool is for generating test data only. Never use it on production databases. Generated data is randomized and not intended to be meaningful.

Generate SQL (No Database Connection)

Generation timing: 0.00s | 0 rows/s
SQL Preview (First 10 rows)

                                
                            

Connect to Database and Populate Data

Warning! This will execute INSERT statements on your database. Ensure you have a backup or are using a test environment.
Progress
Ready...
Elapsed: 0.00s | Throughput: 0 rows/s | ETA: --

DIY / CLI Instructions

Manual Execution Steps

Follow these steps to run the data generator manually via command line.

1. Download the script from this project repository
wget https://raw.githubusercontent.com/kedarvj/mysql-random-data-generator/refs/heads/master/populate.sql
2. Load the procedure into your database
mysql -u username -p db_name < populate.sql
3. Call the populate procedure

Arguments: CALL populate(database_name, table_name, num_rows, 'Y/N' [debug-mode])

mysql -u username -p db_name -e "CALL populate('my_db', 'my_table', 1000, 'N')"

Why This Tool Exists

Generating test data is often a tedious and repetitive task for developers and DBAs. Writing custom scripts or manually creating SQL statements to fill tables can lead to errors and consume valuable development time. This tool solves that problem by providing an automated, predictable, and safe way to generate test data, allowing you to focus on building features rather than filling databases.

How It Works

Paste a MySQL CREATE TABLE statement and generate randomized SQL INSERT statements without connecting to a database. This is useful when you need a standalone SQL file for a development, testing, or local environment.

Connect to a MySQL database and populate an existing table with randomized test data. The generator inspects the table schema and inserts data in batches, making it useful for quickly preparing development and test databases.

If you prefer working from a terminal, you can download the populate.sql procedure and execute it using the MySQL command line client. This provides a simple way to generate repeatable test data from scripts and development environments.

Generate Test Data for MySQL

Creating large amounts of test data manually can be time-consuming, especially when testing MySQL queries, applications, schema changes, migrations, or database performance. This MySQL test data generator creates randomized data based on your table structure so you can quickly populate development and test environments.

You can generate a SQL file without connecting to a database, populate an existing MySQL table directly, or use the command line for repeatable test-data generation.

Host Locally

Run this project on your machine using PHP and MySQL for full browser, API, and direct population support.

Follow the setup guide for prerequisites, local server commands, and database connection notes.

Inspired by the original mysql-random-data-generator project.

Open Local Hosting Steps

Common Uses for MySQL Test Data

Randomized test data can be useful in many MySQL development and database administration workflows, including:

  • Testing SQL queries against larger datasets
  • Testing application changes and new features
  • Testing database schema changes and migrations
  • Testing MySQL replication and failover scenarios
  • Performance and load testing
  • Populating local and development databases
  • Testing backup and restore procedures
  • Creating repeatable datasets for development workflows

Frequently Asked Questions

Is this safe for production?

No. This tool is strictly for test and development data. Never use it on production databases as it performs bulk insertions and generates randomized data.

Are credentials stored?

No. Database credentials are only used for the current session and are never logged, stored, or transmitted to any third-party services.

Can I use it without database access?

Yes. Mode 1 allows you to generate SQL files entirely on your machine without requiring any database connection or permissions.

What limits apply?

For browser stability, we apply a 100,000 row limit for SQL generation. Direct database population is batched to prevent timeouts.

Support & Feedback

If you encounter bugs or have feature requests, report it on GitHub page.

Transparency

No telemetry. No tracking. Just a tool for DBAs and developers.