MySQL Database
Popular relational database server
Relational database server for local development using the latest MySQL version.
Docker Configuration
Image: mysql:latest
Ports: 3306:3306
Volume: damp_mysql_data:/var/lib/mysqlDAMP identifies the service using Docker labels. Container name is auto-generated by Docker.
Port Configuration
Default ports: 3306 (host) → 3306 (container)
If port 3306 is occupied on the host machine, DAMP automatically uses the next available port. Check the DAMP interface to see the actual port assigned.
Environment Variables
| Variable | Value | Description |
|---|---|---|
MYSQL_ROOT_PASSWORD | rootpassword | Root account password |
MYSQL_DATABASE | development | Default database |
MYSQL_USER | developer | Non-root user |
MYSQL_PASSWORD | devpassword | User password |
Connection Information
From Host Machine (Windows)
Connect from your Windows host to the MySQL service.
mysql -h localhost -P 3306 -u developer -pdevpassword developmentConnection Details:
- Host:
localhost - Port:
3306(or actual port shown in DAMP) - User:
developer - Password:
devpassword - Database:
development
Connection String:
mysql://developer:devpassword@localhost:3306/developmentFrom Project Containers
Connect from your DevContainers or other Docker containers to the MySQL service.
Use the container name or ID shown in the DAMP interface.
# Using container name from DAMP
mysql -h [container-name] -u developer -pdevpassword developmentLaravel .env Configuration:
DB_CONNECTION=mysql
DB_HOST=[container-name]
DB_PORT=3306
DB_DATABASE=development
DB_USERNAME=developer
DB_PASSWORD=devpasswordReplace [container-name] with the actual container name displayed in DAMP.
Common Operations
Create New Database
mysql -h localhost -u root -prootpassword
CREATE DATABASE my_new_db;
GRANT ALL ON my_new_db.* TO 'developer'@'%';
FLUSH PRIVILEGES;Import SQL File
# From host
mysql -h localhost -u developer -pdevpassword development < backup.sql
# From project container (use container name from DAMP)
mysql -h [container-name] -u developer -pdevpassword development < backup.sqlBackup Database
mysqldump -h localhost -u developer -pdevpassword development > backup.sqlData Persistence
All data is stored in the damp_mysql_data Docker volume. Removing the service preserves your databases.