Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I want to run a single batch command that must take mySQLfile.sql and compress it by minifying it. Any suggestions on how to get mysqldump to produce the most compressed SQL file?

It would be cool if I could type something like:

mysqldump -bla -bla bla bla > db.sql
minify db.sql

I'm trying to establish:

  1. If the minify.exe is something I would have to write? (so it works for SQL)
  2. If Mysqldump has parameters that will leave out comments and any other unnecessary dump data?
share|improve this question
    
what command line you mean? Shell or mysql? –  Tomas Apr 3 '12 at 0:22
    
I mean windows command line / dos / command line / anything that works in windows dos prompt. –  coderama Apr 3 '12 at 16:13
    
Just compress it with tar? tar -cvzf db.tar.gz db.sql –  Zipp Mar 14 '13 at 19:03

1 Answer 1

Half-Answer: For T-SQL (microsoft's variant) you can use the poor man's T-SQL Formatter library, eg look on http://poorsq.com. If you need to be able to run it from the command-line, the command-line formatter would need to be enhanced to support the "minify" option.

On the other hand, I don't think MySQL's variant of SQL is particularly well handled (I've never spent any time testing it) as this formatter library is firmly focused on T-SQL, so this would likely be an unreliable process.

You might want to give it a shot, you never know, your code might be simple enough that it works reliably!

share|improve this answer

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.