4

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?
3
  • what command line you mean? Shell or mysql?
    – Tomas
    Apr 3, 2012 at 0:22
  • I mean windows command line / dos / command line / anything that works in windows dos prompt. Apr 3, 2012 at 16:13
  • Just compress it with tar? tar -cvzf db.tar.gz db.sql
    – Zipp
    Mar 14, 2013 at 19:03

2 Answers 2

1

Half-Answer: For T-SQL (microsoft's variant) you can use the poor man's T-SQL Formatter library, eg look on http://poorsql.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!

0
0

pg-minify, although was originally written for PostgreSQL scripts, works well with most SQL notations.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .