Skip to content

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Database maintenance from console.
#!/bin/bash
# Backup database from console
DATABASE=
DEFAULTS_FILE=$DATABASE.cnf
BACKUP_DIR=
LOGS_DIR=
DB_OUT_FILENAME=$DEFAULTS_FILE-`date +\%Y\%m\%d`.sql.gz
mysqldump --defaults-extra-file=$DEFAULTS_FILE $DATABASE 2>> $LOGS_DIR/$DATABASE.log | gzip - > $BACKUP_DIR/$DB_OUT_FILENAME
[client]
host=
user=
password=
#!/bin/bash
# Truncate database tables from console
DATABASE=
DEFAULTS_FILE=$DATABASE.cnf
mysql --defaults-extra-file="$DEFAULTS_FILE" -Nse 'show tables' $DATABASE | while read table; do mysql --defaults-extra-file="$DEFAULTS_FILE" -e "truncate table $table" $DATABASE; done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.