https://github.com/takashiraki/docker_mysql
This is the repository for the mysql container
https://github.com/takashiraki/docker_mysql
docker docker-mysql mysql
Last synced: 4 months ago
JSON representation
This is the repository for the mysql container
- Host: GitHub
- URL: https://github.com/takashiraki/docker_mysql
- Owner: takashiraki
- License: mit
- Created: 2023-10-04T09:35:29.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2025-11-10T08:29:12.000Z (7 months ago)
- Last Synced: 2025-11-10T10:19:49.586Z (7 months ago)
- Topics: docker, docker-mysql, mysql
- Homepage:
- Size: 6.84 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Docker MySQL Setup
A Docker-based MySQL database setup using Docker Compose for easy deployment and management.
## Description
This repository provides a simple and efficient way to run a MySQL database instance using Docker containers. It's designed to work with an external Docker network (`my_infra_network`) for easy integration with other services.
## Features
- MySQL database container
- Environment variable configuration
- Persistent data storage using volumes
- Network integration with external Docker network
- Easy port mapping configuration
## Prerequisites
- Docker
- Docker Compose
- An existing Docker network named `my_infra_network`
## Setup
1. Clone this repository:
```bash
git clone
cd docker_mysql_old_2
```
2. Create a `.env` file with the following variables:
```
MYSQL_HOST=localhost
MYSQL_USER=your_user
MYSQL_PASSWORD=your_password
MYSQL_ROOT_PASSWORD=your_root_password
DB_PORT=3306
```
3. Create the external network if it doesn't exist:
```bash
docker network create my_infra_network
```
4. Start the database:
```bash
docker-compose up -d
```
## Configuration
The database configuration is managed through environment variables defined in your `.env` file:
- `MYSQL_HOST`: Database host
- `MYSQL_USER`: MySQL user
- `MYSQL_PASSWORD`: MySQL user password
- `MYSQL_ROOT_PASSWORD`: MySQL root password
- `DB_PORT`: Port to expose the database on the host machine
## Data Persistence
Database data is persisted in the `./database/data` directory on your host machine, which is mounted to `/var/lib/mysql` in the container.
## Stopping the Database
```bash
docker-compose down
```
To remove the data volume as well:
```bash
docker-compose down -v
```
## License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.