Tuesday, October 7, 2025

.::: Backup Database MariaDB with encripted -aes-256-cbc dan restore mariadb database :::.


1. backup enkripsi

mysqldump -uroot -pxxx teguhth | openssl enc -aes-256-cbc -md sha1 -salt -out teguhthenc.sql.enc
mysqldump -uroot -pxxx teguhth | openssl enc -pass pass:abcde -aes-256-cbc -md sha1 -salt -out teguhthenc.sql.enc
mysqldump -uroot -pxxx teguhth | openssl enc -pass pass:abcde -aes-256-cbc -md sha1 -salt -out teguhthenc.sql.enc | gzip -c  > teguhthenc.gz.sql.enc

 
 

2. convert to sql from enkripsi file to sql
openssl enc -d -aes-256-cbc -md sha1 -in teguhthenc.sql.enc -out teguhth.sql -pass pass:abcde
 


3. restore database 

mysql -uroot -pxxx enc < teguhth.sql

or 

openssl enc -d -aes-256-cbc -md sha1 -in teguhthenc.sql.enc -out teguhth.sql -pass pass:abcde | mysql -uroot -pxxx enc < teguhth.sql

or 

gunzip -c < teguhthenc.gz.sql.enc | openssl enc -d -aes-256-cbc -md sha1 -in teguhthenc.sql.enc -out teguhth.sql -pass pass:abcde | mysql -uroot -pxxx enc < teguhth.sql
 
 
 
4. only restore to sql
 
openssl enc -d -aes-256-cbc -md sha1 -k '[FULL]_db_teguhth.sql.enc' -in '[FULL]_db_teguhth.sql.enc' | gunzip -c > hasil_descr.sql 
 
5. or 
 ##
openssl enc -d -aes-256-cbc -md sha1 -k '[FULL]_db_teguhth.sql.enc' -in '[FULL]_db_teguhth.sql.enc' -out hasil_descr.gz 
 
## gunzip -c hasil_descr.gz > hasil_descr.sql 

No comments:

Post a Comment

Popular Posts