Запаковываем:
$ 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 @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;