Skip to content

Instantly share code, notes, and snippets.

@vuthaihoc
Created November 15, 2020 16:02
Show Gist options
  • Save vuthaihoc/60216e1c41f01b4fa2131e2d6915c667 to your computer and use it in GitHub Desktop.
Save vuthaihoc/60216e1c41f01b4fa2131e2d6915c667 to your computer and use it in GitHub Desktop.
Dump DB with mysql info from .env file (laravel)
#!/bin/bash
export $(cat current/.env | sed 's/#.*//g' | xargs)
export MYSQL_PWD=$DB_PASSWORD
mysqldump -u $DB_USERNAME $DB_DATABASE \
--no-tablespaces \
--verbose \
--result-file $DB_DATABASE.sql
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment