Path: csiph.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Harry Tuttle Newsgroups: comp.databases.postgresql Subject: Re: migrate from mysql to pgsql Date: Fri, 30 Oct 2015 20:26:09 +0100 Lines: 39 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Trace: individual.net mWURtQlHK9QnC4IsPcBxgQvt7u6Ejq+8DVVCiiQzXEi9cUJsI= Cancel-Lock: sha1:DNpgOI4RlSSyLWUhl0KSgkSXMqM= User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.8.1.21) Gecko/20090302 Thunderbird/2.0.0.21 Mnenhy/0.7.5.666 In-Reply-To: Xref: csiph.com comp.databases.postgresql:676 Magnus Warker schrieb am 30.10.2015 um 20:00: > I would like to migrate a mysql database to pgsql. > I would like to do it table for table. > > Can you export a table into a plain-text SQL file so that it can be edited and imported in pgsql? Ora2Pg has been a reliable tool to migrate from Oracle to Postgres. The latest release also supports migrating from MySQL to Postgres, you might want to look into that: http://ora2pg.darold.net/ Apart from that, you can use any tool that is capable of exporting CSV files and then import them using Postgres' COPY command. I haven't really used MySQL but I believe SELECT ... INTO OUTFILE should be usable to do this table by table. I use a SQL tool called SQL Workbench/J which can bulk export all tables from a database: http://www.sql-workbench.net/ and http://www.sql-workbench.net/manual/command-export.html I have used that successfully for migrations from Oracle to Postgres. Another option is to install mysql_fdw in Postgres and then simply pull the MySQL data through SQL statements from within Postgres: http://pgxn.org/dist/mysql_fdw/ As a final note: if you need help with Postgres, you'll get better responses on the Postgres mailing list http://www.postgresql.org/list/ Once you are registered you can also read them through a newsgroup on news.gmane.org