MySQL
MySQL is the world's most popular open-source relational database, trusted by millions of applications worldwide.
MySQL is a fast, reliable, and easy-to-use open-source relational database management system used by high-profile web applications.
Docker Compose Configuration
- Creates
docker.compose.ymlat project root with MySQL service - Image:
mysql:latestofficial Docker image - Container: Named
mysql-{projectName}for easy identification - Environment Variables:
MYSQL_ROOT_PASSWORD: password (change in production)MYSQL_DATABASE:mysql-{projectName}MYSQL_USER: mysqlMYSQL_PASSWORD: password
- Ports: Exposes port 3306 (MySQL default)
- Volume: Persistent storage at
mysql-{projectName}-data:/var/lib/mysql - Network: Dedicated bridge network
mysql-{projectName}-network - Command:
--max-connections=100 --default-authentication-plugin=mysql_native_password - Healthcheck:
- Test:
mysqladmin ping -h localhost -u root -ppassword - Interval: 10s, Timeout: 5s, Retries: 5
- Start period: 30s for initialization
- Test:
Connection String Format:
mysql://mysql:password@localhost:3306/mysql-{projectName}
