My OS is windows 7.
- How can I encrypt data while performing a mysqldump?
- From the command prompt, can I take a mysqldump with encrypted varchar and texts values?
Please help me.
Thanks
My OS is windows 7.
Please help me.
Thanks
You can use ccrypt. Example:
Creating the key file:
echo 'mySecretKey123' > ~/.backup.key
chmod 600 ~/.backup.key
Encrypting the backup:
mysqldump databasename | ccrypt -k ~/.backup.key | bzip -c > ~/backup-mysql.sql.bz2.cpt
To decrypt the backup:
cat ~/backup-mysql.sql.bz2.cpt | ccat -k ~/.backup.key | bunzip2 -c | less
To encrypt your mysqldump data in windows try the following command at the command prompt:
mysqldump *databaseName* > *dbNameBackup.sql* && cipher /e /a *dbNameBackup.sql*
Using a password inside the script is a really bad idea as this can be seen in ps aux and read out by every system user.
I would suggest you to look into mysqldump-secure. This is a shell script that does openssl encryption based on public-private key encryption and is a lot more performant than gpg. Additionally it will compress your databases and writes a log file of success/failure. It also ships with a nagios plugin that will let you know any problems that happened during the dump.