Skip to content
A Python script to automate SQL dumps via phpMyAdmin's web interface
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore Updated README May 7, 2019 Merge branch 'master' into pull/7 May 7, 2019

What is it?

A Python 3 script to automate the download of SQL backups via a phpMyAdmin web interface.

This is useful when your web hosting provider does not grant you access to a console (for mysqldump) but you want to automate the backup of your database (without having to manually use the browser).

It has been tested with Python 3.4+ on Linux and Windows and the following versions of phpMyAdmin: 4.3.x - 4.8.x, 5.0.0

Note: The web interface of phpMyAdmin may change in the future and break this script. Please file a bug report (including your version of phpMyAdmin) if you encounter this issue.


usage: [-h] [-o OUTPUT_DIRECTORY] [-p]
                                [-e EXCLUDE_DBS] [-s SERVER_NAME]
                                [--compression {none,zip,gzip}]
                                [--basename BASENAME] [--timeout TIMEOUT]
                                [--prefix-format PREFIX_FORMAT] [--dry-run]
                                [--http-auth HTTP_AUTH]
                                URL USERNAME PASSWORD

Automates the download of SQL dump backups via a phpMyAdmin web interface.

positional arguments:
  URL                   phpMyAdmin login page url
  USERNAME              phpMyAdmin login username
  PASSWORD              phpMyAdmin login password

optional arguments:
  -h, --help            show this help message and exit
                        output directory for the SQL dump file (default: the
                        current working directory)
  -p, --prepend-date    prepend current UTC date & time to the filename; see
                        the --prefix-format option for custom formatting
  -e EXCLUDE_DBS, --exclude-dbs EXCLUDE_DBS
                        comma-separated list of database names to exclude from
                        the dump
  -s SERVER_NAME, --server-name SERVER_NAME
                        mysql server hostname to supply if enabled as field on
                        login page
  --compression {none,zip,gzip}
                        compression method for the output file - must be
                        supported by the server (default: none)
  --basename BASENAME   the desired basename (without extension) of the SQL
                        dump file (default: the name given by phpMyAdmin); you
                        can also set an empty basename "" in combination with
                        --prepend-date and --prefix-format
  --timeout TIMEOUT     timeout in seconds for the requests (default: 60)
  --overwrite-existing  overwrite existing SQL dump files (instead of
                        appending a number to the name)
  --prefix-format PREFIX_FORMAT
                        the prefix format for --prepend-date (default:
                        "%Y-%m-%d--%H-%M-%S-UTC_"); in Python's strftime
                        format. Must be used with --prepend-date to be in
  --dry-run             dry run, do not actually download any file
  --http-auth HTTP_AUTH
                        Basic HTTP authentication, using format

Written by Christoph Haunschmidt et al., version: 2019-05-07.1

Examples "" your_user your_password

Downloads a plain text .sql backup of all databases to the current working directory. "" your_user your_password --exclude-dbs mydb2,mydb4 --prepend-date --basename example_dump --output-directory /tmp --compression zip

Downloads a zipped dump with databases mydb2 & mydb4 excluded, the base name example_dump and a prepended UTC date / time to the directory /tmp, e.g. /tmp/


Note for Windows users: while it is possible to install the requirements natively, it is often easier to use the Windows Subsystem for Linux if you are using Windows 10


Currently, there is no changelog; the best option at the moment is to read the commit messages.




  • Christoph Haunschmidt (original author)
  • Jason Harper (optional mysql server hostname)
  • Jonas Bengtsson (older frame-based phpMyAdmin support)
  • Benoît Courtine (HTTP Auth)
You can’t perform that action at this time.