You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

mysql_backup.sh 338B

12345678910111213141516
  1. #!/bin/bash
  2. # Set the database credentials
  3. DB_USER="root"
  4. DB_PASS="root@123"
  5. DB_NAME="triq_demo"
  6. # Set the backup directory
  7. BACKUP_DIR="/mysql_backup"
  8. # Set the backup filename format
  9. DATE=$(date +"%Y-%m-%d_%H-%M-%S")
  10. FILENAME="${DB_NAME}_${DATE}"
  11. # Create the backup
  12. mysqldump -u $DB_USER -p$DB_PASS $DB_NAME > $BACKUP_DIR/$FILENAME