Databases 3 min read

Generating Test Data for MySQL Using the mysql_random_load_data Tool

This article demonstrates how to quickly generate large volumes of test data for a MySQL table using the open‑source mysql_random_load_data tool, describing the setup, performance, and advantages over traditional stored procedures or custom scripts.

Aikesheng Open Source Community
Aikesheng Open Source Community
Aikesheng Open Source Community
Generating Test Data for MySQL Using the mysql_random_load_data Tool

Problem: I already have a table schema and want to create experimental data. Besides using stored procedures or writing my own programs, what fast methods are available?

Experiment: First we create a database, then a table with many columns, and download the required tools. Using mysql_random_load_data we generate data. On a typical virtual machine, generating 100,000 rows for a 26‑column table takes about four minutes.

Below is a glimpse of the generated data:

The text generation rules differ according to the length of each field; the documentation (shown in the images) illustrates these rules.

Note that the Lorem Ipsum text is not random. It originates from Cicero’s 45 BC work “de Finibus Bonorum et Malorum,” which became popular during the Renaissance.

The mysql_random_load_data tool also supports generating data that respects foreign‑key relationships.

Conclusion: Percona has contributed many useful tools, and mysql_random_load_data is a relatively unknown but powerful one. When we need to run experiments with tools like sysbench or mysqlslap, customizing table structures can be cumbersome, and other generators require manual translation of the schema. This tool, written in Go, is clear and easy to modify. Readers are invited to suggest improvements; if enough demand arises, a dedicated branch may be created.

What MySQL technical topics would you like to learn about next? Leave a comment below!

Want to see more technical articles? Click “Reading” now!

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

Data GenerationtestingGomysql
Aikesheng Open Source Community
Written by

Aikesheng Open Source Community

The Aikesheng Open Source Community provides stable, enterprise‑grade MySQL open‑source tools and services, releases a premium open‑source component each year (1024), and continuously operates and maintains them.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.