{"id":15683829,"url":"https://github.com/joseluisq/docker-mysql-client","last_synced_at":"2025-08-22T14:12:22.336Z","repository":{"id":146282101,"uuid":"469733211","full_name":"joseluisq/docker-mysql-client","owner":"joseluisq","description":"MySQL 8 client programs with easy database export and import functionality.","archived":false,"fork":false,"pushed_at":"2025-08-17T20:34:41.000Z","size":45,"stargazers_count":17,"open_issues_count":0,"forks_count":6,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-08-17T22:19:53.456Z","etag":null,"topics":["debian-12","debian-bookworm","debian11","docker-image","linux-amd64","mysql","mysql8-client","mysql80"],"latest_commit_sha":null,"homepage":"","language":"Dockerfile","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/joseluisq.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE-APACHE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2022-03-14T12:55:36.000Z","updated_at":"2025-08-17T20:32:53.000Z","dependencies_parsed_at":"2024-03-05T15:10:04.605Z","dependency_job_id":"d0a5ab6c-cca0-4760-a0e1-92f527a1fbe2","html_url":"https://github.com/joseluisq/docker-mysql-client","commit_stats":{"total_commits":17,"total_committers":1,"mean_commits":17.0,"dds":0.0,"last_synced_commit":"e7001eb406ab7f4a22418a319f93345b22df34da"},"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"purl":"pkg:github/joseluisq/docker-mysql-client","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joseluisq%2Fdocker-mysql-client","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joseluisq%2Fdocker-mysql-client/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joseluisq%2Fdocker-mysql-client/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joseluisq%2Fdocker-mysql-client/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/joseluisq","download_url":"https://codeload.github.com/joseluisq/docker-mysql-client/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joseluisq%2Fdocker-mysql-client/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271650860,"owners_count":24796725,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-22T02:00:08.480Z","response_time":65,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["debian-12","debian-bookworm","debian11","docker-image","linux-amd64","mysql","mysql8-client","mysql80"],"created_at":"2024-10-03T17:08:55.031Z","updated_at":"2025-08-22T14:12:22.251Z","avatar_url":"https://github.com/joseluisq.png","language":"Dockerfile","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Docker MySQL 8 Client\n\n[![devel](https://github.com/joseluisq/docker-mysql-client/actions/workflows/devel.yml/badge.svg)](https://github.com/joseluisq/docker-mysql-client/actions/workflows/devel.yml) ![Docker Image Size](https://img.shields.io/docker/image-size/joseluisq/mysql-client/8) ![Docker Image Version](https://img.shields.io/docker/v/joseluisq/mysql-client/8) ![Docker Pulls](https://img.shields.io/docker/pulls/joseluisq/mysql-client.svg)\n\n\u003e [MySQL 8 client](https://dev.mysql.com/doc/refman/8.0/en/programs-client.html) for export and import databases easily using Docker.\n\nThis is a __Linux Docker image__ using the latest __Debian [12-slim](https://hub.docker.com/_/debian/tags?page=1\u0026name=12-slim)__ ([Bookworm](https://www.debian.org/News/2023/20230610)).\n\n_**Note:** If you are looking for a **MariaDB Client** then go to [Alpine MySQL Client](https://github.com/joseluisq/alpine-mysql-client) project._\n\n🐳  View on [Docker Hub](https://hub.docker.com/r/joseluisq/mysql-client/)\n\n## MySQL 8 Client programs\n\n```sh\nmyisam_ftdump\nmysql\nmysql_config_editor\nmysql_exporter\nmysql_importer\nmysqladmin\nmysqlcheck\nmysqldump\nmysqldumpslow\nmysqlimport\nmysqlpump\nmysqlshow\nmysqlslap\n```\n\nFor more details see the official [MySQL 8 Client Programs](https://dev.mysql.com/doc/refman/8.0/en/programs-client.html) documentation.\n\n## Usage\n\n```sh\ndocker run -it --rm joseluisq/mysql-client mysql --version\n# mysql  Ver 8.0.43 for Linux on x86_64 (MySQL Community Server - GPL)\n```\n\n## User privileges\n\n- The default user (unprivileged) is `mysql`.\n- `mysql` home directory is located at `/home/mysql`.\n- If you want a fully privileged user try `root`. E.g. append a `--user root` argument to `docker run`.\n\n## Exporter\n\n`mysql_exporter` is a custom tool that exports a database script using `mysqldump`. Additionally, it supports gzip compression.\nIt can be configured via environment variables or using `.env` file.\n\n### Setup via environment variables\n\n```env\n# Connection settings (optional)\nDB_PROTOCOL=tcp\nDB_HOST=127.0.0.1\nDB_PORT=3306\nDB_DEFAULT_CHARACTER_SET=utf8\n\n# GZip export file (optional)\nDB_EXPORT_GZIP=false\n\n# SQL or Gzip export file (optional).\n# If `DB_IMPORT_GZIP` is `true` then file name should be `database_name.sql.gz`\nDB_EXPORT_FILE_PATH=database_name.sql\n\n# Database settings (required)\nDB_NAME=\"\"\nDB_USERNAME=\"\"\nDB_PASSWORD=\"\"\n\n# Additional arguments (optional)\nDB_ARGS=\n```\n\n**Notes:**\n\n- `DB_EXPORT_GZIP=true`: Compress the SQL file using Gzip (optional). If `false` or not defined then the exported file will be a `.sql` file.\n- `DB_ARGS`: can be used to pass more `mysqldump` arguments (optional). \n- A `.env` example file can be found at [./8.0/env/mysql_exporter.env](./8.0/env/mysql_exporter.env)\n\n### Export a database using a Docker container\n\nThe following Docker commands create a container to export a database and then remove the container automatically.\n\nNote that `mysql_exporter` supports environment variables or a `.env` file can be passed as an argument.\n\n```sh\ndocker run --rm -it \\\n    --volume $PWD:/home/mysql/sample \\\n    --user $(id -u $USER):$(id -g $USER) \\\n    --workdir /home/mysql/sample \\\n        joseluisq/mysql-client:8 \\\n        mysql_exporter production.env\n\n# MySQL 8 Client - Exporter\n# =========================\n# mysqldump  Ver 8.0.43 for Linux on x86_64 (MySQL Community Server - GPL)\n\n# Exporting database `mydb` into a SQL script file...\n# Output file: database_name.sql (SQL Text)\n# mysqldump: [Warning] Using a password on the command line interface can be insecure.\n# Database `mydb` was exported on 0s successfully!\n# File exported: database_name.sql (4.0K / SQL Text)\n```\n\n__Notes:__\n\n- `--volume $PWD:/home/mysql/sample` specifies a bind mount [directory](https://docs.docker.com/storage/bind-mounts/) from the host to the container.\n- `$PWD` is just an example host working directory. Use your path.\n- `/home/mysql/` is the default home directory user (optional). View the [User privileges](#user-privileges) section above.\n- `/home/mysql/sample` is a container directory that Docker will create for us.\n- `--workdir /home/mysql/sample` specifies the working directory used by default inside the container.\n- `production.env` is a custom env file path with the corresponding environment variables passed as arguments. That file should be available in your host working directory. E.g `$PWD` in this case.\n\n### Export a database using a Docker Compose file\n\n```yaml\nversion: \"3.3\"\n\nservices:\n  exporter:\n    image: joseluisq/mysql-client:8\n    env_file: .env\n    command: mysql_exporter\n    working_dir: /home/mysql/sample\n    volumes:\n      - ./:/home/mysql/sample\n    networks:\n      - default\n```\n\n## Importer\n\n`mysql_importer` is a custom tool that imports a SQL script file (text or Gzip) using `mysql` command.\nIt can be configured via environment variables or using `.env` file.\n\n### Setup via environment variables\n\n```env\n# Connection settings (optional)\nDB_PROTOCOL=tcp\nDB_HOST=127.0.0.1\nDB_PORT=3306\nDB_DEFAULT_CHARACTER_SET=utf8\n\n# GZip import support (optional)\nDB_IMPORT_GZIP=false\n\n# SQL or Gzip import file (required)\n# If `DB_IMPORT_GZIP` is `true` then file name should be `database_name.sql.gz`\nDB_IMPORT_FILE_PATH=database_name.sql\n\n# Database settings (required)\nDB_NAME=\"\"\nDB_USERNAME=\"\"\nDB_PASSWORD=\"\"\n\n# Additional arguments (optional)\nDB_ARGS=\n```\n\n### Import a SQL script via a Docker container\n\nThe following Docker commands create a container to import an SQL script file to a specific database and remove the container afterward.\n\nNote that `mysql_importer` supports environment variables or a `.env` file can be passed as an argument.\n\n```sh\ndocker run --rm -it \\\n    --volume $PWD:/home/mysql/sample \\\n    --user $(id -u $USER):$(id -g $USER) \\\n    --workdir /home/mysql/sample \\\n        joseluisq/mysql-client:8 \\\n        mysql_importer production.env\n\n# MySQL 8 Client - Importer\n# =========================\n# mysql  Ver 8.0.43 for Linux on x86_64 (MySQL Community Server - GPL)\n\n# Importing a SQL script file into database `mydb`...\n# Input file: database_name.sql (4.0K / SQL Text)\n# mysql: [Warning] Using a password on the command line interface can be insecure.\n# Database `mydb` was imported on 1s successfully!\n```\n\n**Notes:**\n\n- `DB_IMPORT_GZIP=true`: Decompress a dump file using Gzip (optional). If `false` or not defined then the import file will be treated as a plain `.sql` file.\n- `DB_ARGS`: can be used to pass more `mysql` arguments (optional). \n- A `.env` example file can be found at [./8.0/env/mysql_importer.env](./8.0/env/mysql_importer.env)\n\n## Contributions\n\nUnless you explicitly state otherwise, any contribution intentionally submitted for inclusion in current work by you, as defined in the Apache-2.0 license, shall be dual licensed as described below, without any additional terms or conditions.\n\nFeel free to send some [pull request](https://github.com/joseluisq/docker-mysql-client/pulls) or file some [issue](https://github.com/joseluisq/docker-mysql-client/issues).\n\n## License\n\nThis work is primarily distributed under the terms of both the [MIT license](LICENSE-MIT) and the [Apache License (Version 2.0)](LICENSE-APACHE).\n\n© 2022-present [Jose Quintana](https://joseluisq.net)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjoseluisq%2Fdocker-mysql-client","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjoseluisq%2Fdocker-mysql-client","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjoseluisq%2Fdocker-mysql-client/lists"}