Backup dan Restore MySQL

Sebagian dari ‘krepek’an saya 😀

untuk backup 1 database
# mysqldump -u NAMAUSER -pPASSWORDNYA NAMADATABASE > NAMAFILEBACKUP.sql

untuk backup semua database

# mysqldump -u root -pPASSWORDNYA –all-databases > NAMAFILEBACKUP.sql

untuk kompres zip, tambahin | gzip -9
# mysqldump -u NAMAUSER -pPASSWORDNYA NAMADATABASE | gzip -9 > NAMAFILEBACKUP.zip.sql

untuk restorenya
# mysql -u NAMAUSER -pPASSWORDNYA NAMADATABASE < NAMAFILEBACKUP.sql

 

notes: utk password ada perubahan, dimasukan setelah cmd tersebut dijlnkan, krn cmd2 yg kita jalankan  tersimpan dalam history yg bs dilihat org lain, skalian ini cmd utk menghapus history yg ada 🙂

# history -c;rm -f ~/.bash_history

work as freelancer - i’m a humanize human, a son, a father, a husband, who love coffee and cigarette, lazy and moody, entrepreneur, very easy to sleep, internet addict, bad designer, humorious, playing guitar, can’t singing & cooking, thin body, brown skin, smily, travelling & hiking, art & culture related, etc………

Leave a Reply

Your email address will not be published. Required fields are marked *

Top