Skip to content

Latest commit

 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mysql-sandbox

A ready-to-run MySQL 8.4 container, preloaded with seven sample databases. Used by AnswerLayer engineers as a local data source for development and demos.

Quick start

docker compose up -d

First boot takes a couple of minutes while the dumps in init/ are restored. Subsequent starts are instant — the data lives in the mysql-data named volume. To reset to a clean state:

docker compose down -v && docker compose up -d

Connection details

Setting Value
Host (from host machine) localhost or 127.0.0.1
Host (from another Docker container) host.docker.internal
Port 3306
App user answerlayer / answerlayer
Root user root / sandbox
Default DB scratch

Example:

mysql -h 127.0.0.1 -P 3306 -u answerlayer -panswerlayer

Databases

Database Source / license
sakila Sakila Sample Database — © Oracle, New BSD License
world World Sample Database — © Oracle, Creative Commons Attribution-ShareAlike 3.0
employees datacharmer/test_db — CC-BY-SA 3.0
airline_loyalty Maven Analytics — Airline Loyalty Program (free sample dataset; ~391k flight-activity rows + ~17k loyalty-history rows, Canadian carrier, 2017–2018)
astronomy NASA / STScI — exoplanets from the NASA Exoplanet Archive PSCompPars table, jwst_archive from the MAST JWST archive. Both are US-government public-domain data.
finance Synthetic transaction data generated for testing — no real customers. Schema mirrors a typical retail-banking transaction table.
scratch Empty database for ad-hoc work

Loading your own CSVs

./csv/ on the host is mounted at /var/lib/mysql-files/csv/ inside the container, and local-infile is enabled:

LOAD DATA INFILE '/var/lib/mysql-files/csv/my_file.csv'
  INTO TABLE my_table
  FIELDS TERMINATED BY ',' ENCLOSED BY '"'
  LINES TERMINATED BY '\n'
  IGNORE 1 ROWS;

How it works

The official mysql:8.4 image automatically executes any .sql, .sql.gz, or .sh file in /docker-entrypoint-initdb.d/ on first boot of an empty data volume. The init/ directory in this repo is mounted there. Files are prefixed with a number so they run in a deterministic order.

License

Repository configuration is MIT licensed (see LICENSE). The SQL dumps in init/ retain their original third-party licenses; see the table above.

About

MySQL 8.4 dev sandbox preloaded with sample databases (sakila, world, employees, and four custom public datasets)

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors