Skip to content

Instantly share code, notes, and snippets.

View fathonir's full-sized avatar

Fathoni Rokhman fathonir

  • Universitas Maarif Hasyim Latif
  • Indonesia
  • 05:27 (UTC +07:00)
View GitHub Profile
@fathonir
fathonir / backup-mysql.sh
Last active July 10, 2020 12:27
Backup Script PostgreSQL & MariaDB/MySQL
#!/usr/bin/bash #Centos
#!/bin/bash #Ubuntu
BACKUP_FILE=namadb_$(date +'%Y%m%d').sql
DB_USER=db_user
DB_NAME=db_name
SERVER_TARGET=login@ip:path
mysqldump -u $DB_USER $DB_NAME > $BACKUP_FILE && scp $BACKUP_FILE $SERVER_TARGET && rm -f $BACKUP_FILE