CLI tool for dumping various databases in multiple formats.
CLI tool for dumping various databases like MongoDB, PostgreSQL, MySQL into multiple formats like json, tsv, csv
Linux
wget https://github.com/vrutik2809/dbdump/releases/download/2.0.0/linux_amd64_dbdump
# make the binary executable
chmod +x linux_amd64_dbdump
# move the binary to the desired location (optional)
sudo mv linux_amd64_dbdump /usr/local/bin/dbdumpMacOS
curl https://github.com/vrutik2809/dbdump/releases/download/2.0.0/darwin_amd64_dbdump
# make the binary executable
chmod +x darwin_amd64_dbdump
# move the binary to the desired location (optional)
sudo mv darwin_amd64_dbdump /usr/local/bin/dbdumpWindows
Download the binary: by clicking here
# dump all mongodb collections to json
dbdump mongodb -u admin --password admin123 --host localhost -p 27017 -d test
# dump specific mongodb collections to bson
dbdump mongodb -u admin --password admin123 --host localhost -p 27017 -d test -c "users,posts" -o bson
# dump all postgresql tables to csv
dbdump pg -u postgres --password 123456 --host localhost -p 5432 -d test -o csv
# dump all postgresql tables excluding specific tables to json
dbdump pg -u postgres --password 123456 --host localhost -p 5432 -d test -e users,photos -o json
# dump all mysql tables to tsv
dbdump mysql -u root --password root --host localhost -p 3306 -d test -o tsv
- MongoDB -
json,bson,gzip - PostgreSQL -
json,csv,tsv - MySQL -
json,csv,tsv
| Command | Description |
|---|---|
mongodb |
command for dumping MongoDB database |
pg |
command for dumping PostgreSQL database |
mysql |
command for dumping MySQL database |
-
mongodbflag shorthand description default --username-uusername of the database ''--passwordpassword of the database ''--hosthost of the database localhost--port-pport of the database 0--db-name-ddatabase name --dirdirectory to store the dump dump--srvuse SRV connection format false--collections-cname of the collections to dump []--exclude-collections-ename of the collections to exclude []--output-ooutput format of the dump (json,bson,gzip)json--test-moderun the command in test mode (not showing progress bar) false--help-hhelp for the command -
common for
pgandmysqlflag shorthand description default --username-uusername of the database postgres--passwordpassword of the database 123456--hosthost of the database localhost--port-pport of the database 5432--db-name-ddatabase name --dirdirectory to store the dump dump--tables-tname of the tables to dump []--exclude-tables-ename of the tables to exclude []--output-ooutput format of the dump (json,csv,tsv)json--test-moderun the command in test mode (not showing progress bar) false--help-hhelp for the command
You can always pass the
--helpflag to get help for the command
