Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

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

share|improve this question
    
This is a shout out to everyone answering this question to supply a Windows 7 based answer. If you have Windows-based encryption tools, please readjust your answers where possible –  RolandoMySQLDBA Sep 16 '11 at 16:22
add comment

2 Answers

up vote 1 down vote accepted

To encrypt your mysqldump data in windows try the following command at the command prompt:

 mysqldump *databaseName* > *dbNameBackup.sql* && cipher /e /a *dbNameBackup.sql*
share|improve this answer
    
Excuse me for executing this command any other application I need to install? Also I need to encrypt only varchar and text fields. By using this command can I do like that? Thanks. –  learner Sep 19 '11 at 12:40
    
@learner You do not need to install any extra application for this. Cipher comes with Windows. This will encrypt the whole file. To encrypt only certain columns, you will have to do it before backing up. –  StanleyJohns Sep 19 '11 at 13:28
    
how to decrypt using cipher? –  learner Sep 20 '11 at 4:54
    
@learner to decrypt do: cipher /d /a dbNameBackup.sql –  StanleyJohns Sep 20 '11 at 6:23
add comment

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
    
share|improve this answer
    
Sorry, I didn't see that you are using Windows. The example above is for Linux... –  IT2 Sep 16 '11 at 16:22
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.