Import MySQL dump to PostgreSQL database Import MySQL dump to PostgreSQL database postgresql postgresql

Import MySQL dump to PostgreSQL database


This question is a little old but a few days ago I was dealing with this situation and found pgloader.io.

This is by far the easiest way of doing it, you need to install it, and then run a simple lisp script (script.lisp) with the following 3 lines:

/* content of the script.lisp */LOAD DATABASEFROM mysql://dbuser@localhost/dbnameINTO postgresql://dbuser@localhost/dbname;/*run this in the terminal*/pgloader script.lisp

And after that your postgresql DB will have all of the information that you had in your MySQL SB.

On a side note, make sure you compile pgloader since at the time of this post, the installer has a bug. (version 3.2.0)


Don't expect that to work without editing. Maybe a lot of editing.

mysqldump has a compatibility argument, --compatible=name, where "name" can be "oracle" or "postgresql", but that doesn't guarantee compatibility. I think server settings like ANSI_QUOTES have some effect, too.

You'll get more useful help here if you include the complete command you used to create the dump, along with any error messages you got instead of saying just "Nothing worked for me."


Mac OS X

brew update && brew install pgloaderpgloader mysql://user@host/db_name postgresql://user@host/db_name