Difference between revisions of "Backup isi database MySQL"

From OnnoWiki
Jump to navigation Jump to search
Line 10: Line 10:
  
 
  isidatabase.sql.gz
 
  isidatabase.sql.gz
 +
 +
==Restore Database==
 +
 +
gunzip isidatabase.sql.gz
 +
mysql -u usernamemysql -ppasswordmysql namedb < isidatabase.sql
 +
 +
  
  

Revision as of 04:54, 28 May 2020

Dump isi database MySQL

/usr/bin/mysqldump -u usernamemysql -ppasswordmysql namadb -c

jika kita menginginkan agar file yang di hasilkan langsung di gz, kita dapat menggunakan perintah

/usr/bin/mysqldump -u usernamemysql -ppasswordmysql namadb -c | /bin/gzip -9 > isidatabse.sql.gz

Database akan tersimpan di file

isidatabase.sql.gz

Restore Database

gunzip isidatabase.sql.gz
mysql -u usernamemysql -ppasswordmysql namedb < isidatabase.sql



Referensi

Pranala Menarik