zealmurugan
zealmurugan

Reputation: 329

How to dump data from mysql database to postgresql database?

I have done the depot application using mysql... Now i am in need to use postgres... So i need to dump data from mysql database "depot_development" to postgres database "depot_develop"...

Upvotes: 2

Views: 1484

Answers (3)

Rob Contreras
Rob Contreras

Reputation: 1014

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.lips) 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*/
pgload sctipt.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 you you compile pgloader since at the time of this post, the installer has a bug. (version 3.2.0)

Upvotes: 0

Kosmas
Kosmas

Reputation: 31

Have you tried to copy the tables from one database to the other:

a) export the data from MySQL as a CSV file like:

$> mysql -e "SELECT * FROM table" -h HOST -u USER -p PWD -D DB > /file/path.csv'

and then,

b) import it into Postgres like:

COPY table FROM '/file/path.csv' WITH CSV;

Upvotes: 1

Szymon Lipiński
Szymon Lipiński

Reputation: 28634

Here you can find some interesting links http://wiki.postgresql.org/wiki/Converting_from_other_Databases_to_PostgreSQL#MySQL

Upvotes: 1

Related Questions