Skip to content

Instantly share code, notes, and snippets.

@oxechicao
Last active May 21, 2019 13:45
Show Gist options
  • Save oxechicao/d9c257b05d0d46d2fca211d0dcdd5fa0 to your computer and use it in GitHub Desktop.
Save oxechicao/d9c257b05d0d46d2fca211d0dcdd5fa0 to your computer and use it in GitHub Desktop.
Dump databases command line
# Mongodb
mongodump --host=<hostname> \
          --authenticationDatabase=admin \
          --username=<username> \
          --password=<password> \
          --db=<database> \
          --out=<path to save>
          
mongorestore --db="ge" --dir="<folder-to-import>"

# Mysql
mysqldump --host="<hostname>" \
          --user="<usename>" \
          --password="<password>" \
          <database> > <file-to-export>.sql
          
mysql --host="<hostname>" \
      --user="<username>" \
      --password="<password>"
      <database> < <file-to-import>.sql
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment