How to Import the Exercises Dataset into MySQL: A Complete Guide
The hasaneyldrm/exercises-dataset repository ships a browser-based generator in setup.html that produces a ready-to-run SQL script containing all 1,324 exercise records, which you can load into MySQL with a single terminal command.
This guide walks you through importing the complete exercises collection from JSON into a structured MySQL database. The repository's interactive Developer Setup Guide automates the schema creation and data insertion process, eliminating the need to write manual INSERT statements for the data/exercises.json file.
Step 1: Generate the MySQL Import Script
The repository includes an interactive tool at setup.html that transforms the raw JSON dataset into a standard SQL dump file.
Open setup.html in any modern browser and select the MySQL tab. Click the Generate .sql button to trigger the download. Internally, the page executes a fetch request to data/exercises.json, parses each of the 1,324 exercise records, and constructs a file containing a CREATE TABLE definition followed by individual INSERT statements for every row.
The generated script automatically maps JSON fields to table columns, including multilingual instruction fields (e.g., instructions_en, instructions_es), equipment, category, image, and gif_url.
Step 2: Create the Target Database
Before loading the script, ensure your MySQL server has a database ready to receive the data. Connect to your MySQL instance and run:
CREATE DATABASE IF NOT EXISTS exercises_db;
USE exercises_db;
This creates a dedicated database named exercises_db and switches the active context to that database, ensuring the subsequent table creation occurs in the correct namespace.
Step 3: Import the SQL Script into MySQL
With the database prepared, load the generated file using the standard MySQL client. Assuming you saved the download as exercises_mysql.sql, execute the following from your terminal:
mysql -u <username> -p < exercises_mysql.sql
The client will prompt for your MySQL password. Upon authentication, MySQL executes the script sequentially: first creating the exercises table with the appropriate schema, then inserting all 1,324 records in a single transaction batch.
Step 4: Verify the Data Import
Confirm successful import by checking the record count. Connect to your database and query:
SELECT COUNT(*) FROM exercises;
The query should return 1324, indicating that all exercise entries from the original JSON file are present in the relational table.
You can immediately begin querying the structured data. For example, to retrieve dumbbell exercises sorted alphabetically:
SELECT name, equipment, category
FROM exercises
WHERE equipment = 'dumbbell'
ORDER BY name LIMIT 10;
Understanding the Table Structure
The resulting MySQL table schema mirrors the structure defined in data/exercises.schema.json. Key columns include:
id– Unique identifier for each exercisename– Exercise namecategory– Target muscle group or exercise typeequipment– Required equipment (e.g., dumbbell, barbell, bodyweight)instructions_*– Multilingual instruction fields (e.g.,instructions_en,instructions_de)imageandgif_url– URLs to visual media assets
This schema allows you to perform complex relational queries, joins, and full-text searches across the entire dataset without parsing JSON in your application layer.
Summary
- The
setup.htmlfile in thehasaneyldrm/exercises-datasetrepository generates a complete MySQL import script containingCREATE TABLEandINSERTstatements for all 1,324 exercises. - The source data resides in
data/exercises.json, with schema validation available indata/exercises.schema.json. - Import the generated
.sqlfile using the standardmysql -u <username> -p < filename.sqlcommand. - Verify success by checking that
SELECT COUNT(*) FROM exercisesreturns 1324. - The resulting table includes columns for equipment, categories, multilingual instructions, and media URLs.
Frequently Asked Questions
What is the fastest way to import the exercises dataset into MySQL?
The fastest method is using the browser-based generator in setup.html. Open the file, select the MySQL tab, click Generate .sql, and load the resulting file with mysql -u <username> -p < exercises_mysql.sql. This approach handles schema creation and data insertion automatically without requiring manual JSON parsing or custom scripts.
How many exercise records are included in the dataset?
The dataset contains 1,324 distinct exercise records. After importing, you can verify this count by running SELECT COUNT(*) FROM exercises; in your MySQL client. This number corresponds to the total entries in the source file data/exercises.json.
What columns are created in the MySQL table?
The import script creates columns that map directly to the JSON schema, including id, name, category, equipment, image, gif_url, and multilingual instruction fields (prefixed with instructions_). The schema supports full-text search and relational queries across equipment types and muscle categories.
Can I validate the JSON data before importing it into MySQL?
Yes. The repository includes data/exercises.schema.json, which provides a formal JSON Schema definition for all exercise objects. You can validate the data in data/exercises.json against this schema using any JSON Schema validator before running the SQL import to ensure data integrity and catch any structural anomalies.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →