2

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"...

zealmurugan
  • 329
  • 5
  • 18

3 Answers3

1

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

Szymon Lipiński
  • 27,098
  • 17
  • 75
  • 77
  • i did try that but the syntax where not matching with psql... so had many errors.. it didnt work wel... thanks.. – zealmurugan Oct 22 '10 at 10:34
1

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;
Kosmas
  • 31
  • 3
  • I had the problem of logging in without data in the users table... so i had no choice to insert data copying from the already existing table... so manually inserted data in psql... so the it was ok to work.. thank you.. – zealmurugan Oct 22 '10 at 10:33
  • The mysql query above doesn't create output in CSV. – Garen Dec 07 '13 at 01:29
0

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)

Rob Contreras
  • 924
  • 6
  • 8
  • Duplicate answer: [Import MySQL dump to PostgreSQL database](http://stackoverflow.com/a/28709384/914686)... – Werner Feb 25 '15 at 01:33