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
 

 

No comments:

Post a Comment

Popular Posts