Answer the question
In order to leave comments, you need to log in
How to properly encrypt mysqldump output?
I'm trying to pack the output like this
/usr/bin/mysqldump --opt -v --databases $bd_name -u$user -p$password | bzip2 -9 > backup-$(date +%d-%b-%Y).tar.bz2
We also need to add encryption here.
But for some reason the resulting file is not unpacked afterwards. Tell me how to pack with encryption with one command?
Answer the question
In order to leave comments, you need to log in
Packing:
$ mysqldump --opt -usome_user -psome_pass mysql | openssl enc -aes-256-cbc | bzip2 -9 > backup.bz2
enter aes-256-cbc encryption password:mysqldump:
[Warning] Using a password on the command line interface can be insecure.
Verifying - enter aes-256-cbc encryption password:
$ bzip2 -d backup.bz2
$ head backup
Salted__????,?z"?1f???? 9???>?>??n??q?/?{,??}E2'4*W?e?,+N???
????i??"??Lc[?-??Io?`??3???%fnXf????s??5A<?hz?}...
$ bzip2 -d -c backup.bz2 | openssl enc -aes-256-cbc -d > out.sql
enter aes-256-cbc decryption password:
$ head out.sql
-- MySQL dump 10.13 Distrib 5.7.10, for osx10.11 (x86_64)
--
-- Host: localhost Database: mysql
-- ------------------------------------------------------
-- Server version 5.7.10
/*!40101 SET @[email protected]@CHARACTER_SET_CLIENT */;
/*!40101 SET @[email protected]@CHARACTER_SET_RESULTS */;
/*!40101 SET @[email protected]@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question