Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Import MySQL dump to PostgreSQL database

How can I import an "xxxx.sql" dump from MySQL to a PostgreSQL database?

like image 482
Palani Kannan Avatar asked Mar 24 '11 09:03

Palani Kannan


People also ask

Can I import MySQL dump to PostgreSQL?

It is not possible to import an Oracle (binary) dump to PostgreSQL.

Can we convert MySQL database to PostgreSQL?

To convert MySQL data to PostgreSQL, you will need ODBC Driver for PostgreSQL from Devart. You need to configure its options before proceeding with the data export task. That can be done right from the Data Export Wizard.


1 Answers

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 DATABASE FROM mysql://dbuser@localhost/dbname INTO 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)

like image 78
Rob Contreras Avatar answered Sep 17 '22 13:09

Rob Contreras