Simple command line options to backup a MySQL database:
- backup a database locally using mysqldump, date and time in the filename, and compression
mysqldump -uUSERNAME -pPASSWORD DATABASE | gzip -9 > ~/$(date +%Y-%m-%d-%H%M)_intiotpa_stage.sql
- import compressed file back into database
gunzip < ~/backups/FILENAME.sql.gz | mysql -uUSERNAME -pPASSWORD DATABASE