Beranda > System Administrator > Backup MySQL Otomatis

Backup MySQL Otomatis

Sedikit triks untuk backup mysql database yang paling mudah,

1. Download MySQLBackup Installer
$ wget http://downloads.sourceforge.net/project/automysqlbackup/AutoMySQLBackup/AutoMySQLBackup%20VER%203.0/automysqlbackup-v3.0_rc6.tar.gz?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Fautomysqlbackup%2F&ts=1328494995&use_mirror=superb-dca2

2. Extract dan Run
$ tar-xzvf automysqlbackup-v3.0_rc6.tar.gz
$ sudo ./install.sh

3. Sesuaikan dengan informasi pada server :
### Checking archive files for existence, readability and integrity.
automysqlbackup … exists and is readable … md5sum okay🙂
automysqlbackup.conf … exists and is readable … md5sum okay🙂
README … exists and is readable … md5sum okay🙂
LICENSE … exists and is readable … md5sum okay🙂
Select the global configuration directory [/etc/automysqlbackup]:
Select directory for the executable [/usr/local/bin]:
### Creating global configuration directory /etc/automysqlbackup: success
### Copying files. if running under the current user,
### you have to use the full path /usr/local/bin/ automysqlbackup
### since /usr/local/bin is not in ‘echo $PATH’ Setup Complete!

4. Edit /etc/mysqlbackup/myserver.conf
# Basic Settings
# Username to access the MySQL server e.g. dbuser
CONFIG_mysql_dump_username=’root’
# Password to access the MySQL server e.g. password
CONFIG_mysql_dump_password=’passwordnya’
# Host name (or IP address) of MySQL server e.g localhost
CONFIG_mysql_dump_host=’localhost’
# “Friendly” host name of MySQL server to be used in email log
# if unset or empty (default) will use CONFIG_mysql_dump_host instead
#CONFIG_mysql_dump_host_friendly=”
# Backup directory location e.g /backups
CONFIG_backup_dir=’/home/verrysoon/backup’
# List of databases for Daily/Weekly Backup e.g. ( ‘DB1’ ‘DB2’ ‘DB3’ … )
# set to (), i.e. empty, if you want to backup all databases
CONFIG_db_names=()

5. Buat script sederhana untuk membuat scheduler (misal nama file : runbackup.sh disimpan di /home/verrysoon/)
#~~~~ Copy From Below Here ~~~~
#!/bin/sh
/usr/local/bin/automysqlbackup /etc/automysqlbackup/myserver.conf
chown root.root //home/verrysoon/backup* -R
find /home/verrysoon/backup* -type f -exec chmod 400 {} \;
find /home/verrysoon/backup* -type d -exec chmod 700 {} \;
#~~~~~ Copy To Above Here ~~~~

6. Edit Cron Job
$ crontab -e
5 5 * * 8 /home/verrysoon/runbackup.sh

Scheduler tersebut akan dijalankan setiap hari pukul 05.05 setiap hari dan data backup akan disimpan ke folder /home/verrysoon/backup .

Best Regards,
Verrysoon
http://verrysoon.com

  1. September 22, 2014 pukul 6:00 pm

    Hello there, just became aware of your blog through Google, and found that it’s really informative.
    I am gonna watch out for brussels. I will be grateful if you continue this in future.

    Many people will be benefited from your writing.
    Cheers!

  1. No trackbacks yet.

Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout / Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout / Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout / Ubah )

Foto Google+

You are commenting using your Google+ account. Logout / Ubah )

Connecting to %s