Is there any command line tool for converting the MySQL database to PostgreSQL? I'd also like to know if there is a way to convert the database using the normal
- Anybody can ask a question
- Anybody can answer
- The best answers are voted up and rise to the top
have you tried:
then do this to escape quotes
may need some more massaging so look at mysqldump doco more closely.
Here are a few open source tools, that can be very helpful:
pgloader is a data loading tool for PostgreSQL, using the COPY command. Its main advantage over just using
, and over using a Foreign Data Wrapper, is its transaction behaviour, where pgloader will keep a separate file of rejected data, but continue trying to copy good data in your database. The default PostgreSQL behaviour is transactional, which means that any erroneous line in the input data (file or remote database) will stop the entire bulk load for the table. pgloader also implements data reformatting, a typical example of that being the transformation of MySQL datestamps 0000-00-00 and 0000-00-00 00:00:00 to PostgreSQL
value (because our calendar never had a year zero).
pgloader written in LISP and distributed as source code, so you you need to compile it before using.
Hope it will help you...
There is actually a free migration tool that's quite easy to use, developed by EnterpriseDB themselves. It can be installed via the StackBuilder: Migration Toolkit
You can use EnterpriseDB Migration Wizard, for example.
It can symply migrate OracleDB. But for Mysql, it has some limitations, for example, it not supports views, triggers, stored procedures.
For more, see EDB Migration Toolkit. Not sure, but it can be possible to migrate mysql->oracle->postgresql saving your stored procedures (in case they exists).
Grep this: Database and SQL Migration Tools
I recently use a non-free tool from DBConvert to convert an access database to postgres, and found it well worth the money compared to the amount of time I wasted trying to do it reliably for free. The sell a similar tool for MySQL<->postgres, which I have not used, but may well be worth considering unless you are only interested in command line tools.
In case you are wondering I am not affiliated with them in any way :-)
This is just to add to the existing answers, which helped me find this solution. I used FromMySqlToPostgreSql. All you need to do is to download and extract FromMySqlToPostgreSql, make a copy of the sample config file, set the db connection values in it, and run the index file with the following command:
Simple yet effective!