https://github.com/codemonauts/docker-mysql
https://github.com/codemonauts/docker-mysql
Last synced: 12 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/codemonauts/docker-mysql
- Owner: codemonauts
- Created: 2020-09-09T13:49:04.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2022-01-05T16:14:29.000Z (about 4 years ago)
- Last Synced: 2025-01-18T07:12:03.572Z (about 1 year ago)
- Language: Shell
- Homepage:
- Size: 4.88 KB
- Stars: 1
- Watchers: 4
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# codemonauts/mysql
Simple MySQL 5.7 container with a few handy tools for local development:
* Import/Export script
* [mycli](mycli.net), as an alternative MySQL-client with nicer colors and better tab completion
* [sqlstrip](https://github.com/codemonauts/sqlstrip) to reduce loading time of databas dumps
## Usage with docker-compose
```
services:
db:
image: codemonauts/mysql
restart: always
environment:
MYSQL_ROOT_PASSWORD: topsecret
MYSQL_DATABASE: foo
MYSQL_USER: bar
MYSQL_PASSWORD: baz
volumes:
- .:/data:delegated
- db-data:/var/lib/mysql:delegated
volumes:
db-data:
```
## Import
Place the dump into the same folder where your docker-compose.yml file is located, so the file is visible inside the
container.
```
docker-compose exec db import databasedump.sql.gz
```
The dump can either be plain sql, or an compressed sql file (supported extensions are sql.gz, sql.zst and zip)
## Export
This will dump the database defined by '$MYSQL_DATABASE' into a gzipped file.
```
docker-compose exec db dump
```