Created
December 24, 2017 19:25
-
-
Save parsibox/07738c219f4ee4f3d86383010d29e848 to your computer and use it in GitHub Desktop.
shell script for backup only one table from mysql
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
usage :
sh /var/www/html/backup_mysql_table.sh esmetable