Pārlūkot izejas kodu

Updated DB backup and restore scripts

pull/13/head
Steffan JJ pirms 1 gada
vecāks
revīzija
afd0a58276
2 mainītis faili ar 8 papildinājumiem un 6 dzēšanām
  1. 2
    4
      trias/DB/mysql_backup.sh
  2. 6
    2
      trias/DB/mysql_restore.sh

+ 2
- 4
trias/DB/mysql_backup.sh Parādīt failu

@@ -6,13 +6,11 @@ DB_PASS="root@123"
DB_NAME="triq_demo"

# Set the backup directory
BACKUP_DIR="~/mysql_backup"
BACKUP_DIR="/mysql_backup"

# Set the backup filename format
DATE=$(date +"%Y-%m-%d_%H-%M-%S")
FILENAME="${DB_NAME}_${DATE}.sql"
FILENAME="${DB_NAME}_${DATE}"

# Create the backup
echo mysqldump -u $DB_USER -p$DB_PASS $DB_NAME > $BACKUP_DIR/$FILENAME
mysqldump -u $DB_USER -p$DB_PASS $DB_NAME > $BACKUP_DIR/$FILENAME
# mysqldump -u root -p 'root@123' triq_demo > ~/mysql_backup/temp_1

+ 6
- 2
trias/DB/mysql_restore.sh Parādīt failu

@@ -1,8 +1,12 @@
# Set the database credentials
DB_USER="root"
DB_PASS="root@123"
DB_NAME="triq_demo"

# Set the backup directory
echo "Enter the name of backup file: "
read folderName
BACKUP_FILE="~/mysql_backup/$folderName"
read fileName
BACKUP_FILE="/mysql_backup/$fileName"

# Restore backup file
mysql -u $DB_USER -p$DB_PASS $DB_NAME < $BACKUP_FILE

Notiek ielāde…
Atcelt
Saglabāt