A plugin for Adminer that adds functionality to export SQL commands as downloadable files directly from the SQL command editor interface.
When working with databases through Adminer, users often need to save their SQL queries for documentation, sharing, backup, or version control. While Adminer provides excellent database management capabilities, it lacks a straightforward way to export the current SQL command being edited.
This plugin solves that problem by adding an Export link/button to the SQL command editor, allowing users to:
- Download SQL queries as files with appropriate extensions (
.sql,.js,.json, etc.) based on the database driver - Open queries in a new browser window for quick viewing
- Automatically timestamp exported files for better organization
- Preserve their work for future reference or sharing
- Smart File Extensions – Automatically determines the correct file extension based on the database driver (MySQL, PostgreSQL, MongoDB, Elasticsearch, etc.)
- Multiple Output Options – Export to file or open in a new browser tab
- Timestamp Support – Files are named with timestamps (e.g.,
query_20250131_143025.sql) - CodeMirror Integration – Works seamlessly with Adminer’s CodeMirror SQL editor
- Lightweight – Minimal footprint, no external dependencies
You can use this plugin with the official Adminer Docker image or in a non-Docker setup.
For reference on how to enable and use Adminer plugins, see the official documentation:
👉 https://www.adminer.org/en/plugins/#use
# docker-compose.yml
services:
adminer:
image: adminer:latest
environment:
- ADMINER_PLUGINS=export-command
ports:
- 8080:8080
volumes:
- ./export-command.php:/var/www/html/plugins/export-command.php:roThen start Adminer:
docker compose up -dAccess Adminer at http://localhost:8080.
Run Adminer with the plugin enabled and the file mounted:
docker run -d \
--name adminer \
-p 8080:8080 \
-e ADMINER_PLUGINS=export-command \
-v "$PWD/export-command.php":/var/www/html/plugins/export-command.php:ro \
adminer:latestIf the container is already running:
docker cp export-command.php adminer:/var/www/html/plugins/export-command.php
docker restart adminerIf you’re running Adminer outside of Docker:
- Place
export-command.phpin your Adminerplugins/directory. - Enable it following Adminer’s official plugin usage guide:
👉 https://www.adminer.org/en/plugins
-
Navigate to SQL Command: Open Adminer and go to the "SQL command" page

-
Write Your Query and Click Export: Enter your SQL query in the text area and click in the "Export" fieldset below

-
Select Output and Format: Choose your desired output (i.e.,
open,save) and format (based on the database driver)
-
Download: Your query will be downloaded with a timestamped filename like
query_20250131_143025.sql
If you would like to contribute to this project, please see CONTRIBUTING.md.
Before submitting a PR, you may test your code using Super-Linter:
docker run --rm \
-e ACTIONS_RUNNER_DEBUG=true \
-e RUN_LOCAL=true \
-e DEFAULT_BRANCH=main \
--env-file ".github/super-linter.env" \
-v "$PWD":/tmp/lint \
ghcr.io/super-linter/super-linter:latestSee CODE_OF_CONDUCT.md for community standards.
See SECURITY.md for vulnerability reporting instructions.
Copyright Universidade Federal do Espirito Santo (Ufes)
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see https://www.gnu.org/licenses/.
This program is released under license GNU GPL v3+ license.
