Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#!/bin/sh
BACKUP_DIR=/home/backup
#descargamos la db
mysqldump --host servername -u root -p (rootpass) dbtodump > dumpfile.sql
# para descargar una sola tabla sin descargar toda la db usariamos :
# mysqldump -u root -p rootpass dbname table_name \ /home/backup/table.sql
#para descargarlas todas:
# mysqldump -u root -p rootpass --all-databases > /home/backup/all_database.sql
#compresion de base de datos
tar -cf $BACKUP_DIR/bd$(date +%d-%m-%y_%H:%M).tar dumpfile.sql
#borrado de base de datos despues de la compresion
rm -rf $BACKUP_DIR/dumpfile.sql
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.