The easiest way to migrate a database from MySQL to PostgreSQL

I had to do this recently for a project. The difficult piece was sorting through the opinions of what the best tools and procedures for handling this migration was. So I tried a few until I found one that worked so well, so quickly that I decided it was worth sharing. Firs tthings I used that didn't work well and/or quickly and/or intuitively:

  • mysqldump with various options and various tweaks/scripts/editing of the dump file
  • pgloader

What did work well was py-mysql2pgsql. Once installed it was easy to set the configuration file options and run it. It worked without problem and I would use it again for this task. I can't comment as to whether it will handle all cases, this project didn't contain anything too fancy, but I would recommend it as a place to start:

Leave a Reply

Your email address will not be published. Required fields are marked *