Skip to content

Instantly share code, notes, and snippets.

@parsibox
Created December 24, 2017 19:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save parsibox/07738c219f4ee4f3d86383010d29e848 to your computer and use it in GitHub Desktop.
Save parsibox/07738c219f4ee4f3d86383010d29e848 to your computer and use it in GitHub Desktop.
shell script for backup only one table from mysql
#!/bin/bash
DATE=`date +%Y-%m-%d-%H-%M-%S`
LOCAL_BACKUP_DIR="/var/www/backup"
DB_NAME="xxxxxxxx"
DB_USER="xxxxxxxxx"
DB_PASSWORD="xxxx"
table=$1
############### Local Backup ########################
mysqldump -u $DB_USER -p$DB_PASSWORD $DB_NAME --tables $table | gzip > $LOCAL_BACKUP_DIR/$DB_NAME-$DATE.sql.gz
@parsibox
Copy link
Author

usage :
sh /var/www/html/backup_mysql_table.sh esmetable

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment