A small Docker Compose project that launches a MySQL database and phpMyAdmin, and initializes a sample users table with test data.
docker-compose.yml- defines the MySQL and phpMyAdmin services.init.sql- database schema and seed data loaded automatically by MySQL on first startup.
- Docker
- Docker Compose
mysql- MySQL server usingmysql:latestphpmyadmin- phpMyAdmin UI for database management
- Database:
db_users - Root password:
mypassword - User:
myuser - Password:
pwd123456789
From the project root, run:
docker compose up -dThis will start both services in detached mode.
Open your browser at:
http://localhost:8080
Login with:
- Server:
mysql - Username:
myuser - Password:
pwd123456789
The database is seeded with a users table and three example rows:
John Doe/john@example.comJane Smith/jane@example.comThomas Johnson/thomass@example.com
Start services:
docker compose up -dStop services:
docker compose downView running containers:
docker compose psView MySQL logs:
docker compose logs mysql- The SQL file is mounted to
/docker-entrypoint-initdb.d/init.sql, so it is executed only when MySQL initializes a new data directory. - If you want to reset the database, remove the MySQL volume or container data and restart the stack.