Parsing MySQL dump files
Cosimo Streppone
cosimo at streppone.it
Tue Dec 13 19:31:25 GMT 2011
On Tue, 13 Dec 2011 13:33:55 +0100, Roger Burton West
<roger at firedrake.org> wrote:
> don't want to install MySQL, because it smells.
.oO(LALALALALA...)
> Has anyone done this in Perl? Either a full parse, or a hack to get it
> into a form acceptable to SQLite...
1) Install mysql
2) Load the dump into it
3) Convert db to non-mysql-dialect of sql
mysqldump --compatible=postgres --extended-insert=0 --complete-insert=1 \
-u youruser yourdb \
| gzip -c - \
> yourdb.sql.gz
4) Remove mysql from the system (at this point the smell should be gone)
5) Install postgres
6) Load yourdb.sql.gz into postgres (sqlite should understand it just fine)
7) ??
8) Profit!
Postgres COPY command can export to CSV.
Probably MySQL can do that too.
--
Cosimo
More information about the london.pm
mailing list