4 This is mysql2sql, a mysql to sql converter. It is primary intended to
5 convert mysqldump (especially with extended INSERT syntax) to standard SQL
6 to load at least to PostgreSQL or SQLite.
8 The program is in the early stage of development and currently cannot do
9 much. It removes /\*! directives \*/, unquotes names quoted with backticks,
10 quote non-lowercase names with double quotes, unescapes strings and escapes
11 them to a different quoting style, and passes everything else unmodified.
24 mysql2sql [-e encoding] [-E output_encoding] [-m/-p/-s] [infile] [[-o] outfile]
28 -e ENCODING, --encoding ENCODING
29 input/output encoding, default is utf-8
30 -E OUTPUT_ENCODING, --output-encoding OUTPUT_ENCODING
31 separate output encoding, default is the same as
32 `-e` except for console; for console output charset
33 from the current locale is used
34 -m, --mysql MySQL/MariaDB quoting style
35 -p, --pg, --postgres PostgreSQL quoting style
36 -s, --sqlite Generic SQL/SQLite quoting style (default)
37 -P, --no-pbar Inhibit progress bar
38 infile Input file, stdin if absent or '-'
39 -o, --outfile outfile Output file, stdout if absent or '-'
41 Options `-m/-p/-s` change quoting style. `-m` sets MySQL quoting style;
42 it's added to use the program in the following scenario: convert MySQL
43 dumps with extended INSERTs to SQL with plain INSERTS suitable to be fed
44 back to MySQL. `-p` sets PostgreSQL quoting style; it's like MySQL with
45 additional `E''-style quoting
46 <https://www.postgresql.org/docs/9.1/static/sql-syntax-lexical.html#SQL-SYNTAX-STRINGS-ESCAPE>`_.
47 `-s` sets generic SQL/SQLite quoting style; this is the default.
49 If stderr is connected to the console the program displays a text mode
50 progress bar. Option `-P/--no-pbar` inhibits it.
52 Option `-o` is useful when infile is absent (input is redirected), for
55 mysql2sql -o outfile.sql < infile.sql
56 cat infile.sql | mysql2sql -o outfile.sql
58 But of course it simply can be::
60 mysql2sql - outfile.sql < infile.sql
61 cat infile.sql | mysql2sql - outfile.sql