MySQL to PostgreSQL

Download  |  Buy  |  Tutorial  |  FAQ  |  Release Notes  |  Latest version 6.3 released 12/04/2023

MySQL-to-PostgreSQL is a program to migrate MySQL, MariaDB or Percona databases to PostgreSQL server. The program has high performance due to combination of efficient low-level techniques of reading/writing data and parallel migration algorithm. Command line support allows to script, automate and schedule the conversion process.

Features

  • Tables, data, indexes, constraints and views are migrated
  • Support for on-premises and cloud DBMS: PostgreSQL, MySQL, MariaDB, Percona, Heroku, Azure, Google Cloud, Amazon RDS
  • High performance of the migration
  • Safe types mapping
  • Spatial data is migrated
  • SSL connection for PostgreSQL is supported
  • Option to customize the migration via conversion settings
  • Option to edit tables being converted (modify name, type, default values for every column)
  • Option to merge or synchronize PostgreSQL database with MySQL data
  • Option to export into SQL script file
  • Option to filter data using SELECT-queries
  • Command line support
  • Support for Unicode
  • Quick Launch
  • Stores conversion settings into profile
  • The product can be customized according to customer requirements
    
Video Demonstration

Limitations

Download trial version of MySQL-to-PostgreSQL

Requirements

High Performance

MySQL-to-PostgreSQL uses low-level APIs for reading and writing data: MySQL C API (aka libmysql) and C application programmer's interface to PostgreSQL (aka libpq). Starting from version 6.3 it also applies new parallel migration engine. The main benefit of this technique is capability to set up all parameters automatically depending on hardware platform: volume of single transaction is configured based on available memory and concurrent threads are set up based on number of physical CPU cores. This results performance of database migration is about 500MB per minute on Intel(R) Core(TM) i7-12650H 2.30 GHz system with 32GB RAM.

Quick Launch

Once you stored conversion settings into profile you can run the program in Quick Launch mode. Just open Windows Explorer and double-click on the profile description (.s2p) file with left mouse button. This will launch the wizard to migrate MySQL to PostgreSQL loading the necessary conversion settings from the specified profile. Then you will be taken right to the migration progress screen.

Types Mapping

The application follows these rules of mapping data types when convert MySQL to PostgreSQL:

MySQLPostgreSQL
BINARY(n)BYTEA
BLOBBYTEA
DATETIMETIMESTAMP [WITHOUT TIME ZONE]
FLOATREAL
LONGBLOBBYTEA
MEDIUMBLOBBYTEA
MEDIUMINTINTEGER
TINYBLOBBYTEA
TINYINTSMALLINT
VARBINARY(n)BYTEA

Download trial version of MySQL-to-PostgreSQL

How to Migrate MySQL to PostgreSQL

The process of database migration from MySQL to PostgreSQL consists of the following steps:

Step 1 of 7. Select Conversion Mode

On this screen of MySQL to Postgres migration wizard you need to select the conversion scenario. The converter provides two options to migrate MySQL database:

  • Move to PostgreSQL server directly - use this approach to migrate the source database to the target PostgreSQL server directly. PostgreSQL server must be launched and the user must have necessary privileges to write into database on the target server. See Connect to PostgreSQL Server section for related information.
  • Export into script file - use this approach to export MySQL database into a local script file instead of moving it to PostgreSQL server. The resulting script file contains SQL statements to create all tables, indexes, constraints and to fill tables with the data. See Import PostgreSQL script files article for related information.
Convert MySQL to PostgreSQL: Select Migration Mode

Step 2 of 7. Connect to MySQL

MySQL-to-Postgres can connect MySQL server using either local or remote mode. Local mode is being used to connect MySQL server launched on the same machine where you run the converter from. Remote mode allows you to connect to MySQL server launched on another computer.

By default the program uses local connection mode. It is indicated by radio button "Local" selected. To establish remote connection you should select "Remote" radio button. For remote MySQL servers you should also enter host and TCP/IP port to connect through. Host could be either network name or IP address. TCP/IP port value is necessary only if it differs from the default MySQL port number 3306. Otherwise you may leave this field as is.

Finally, you are entering user name and password. You can leave these fields empty for anonymous connection (if MySQL server allows it).

Migrate MySQL to PostgreSQL: Connect to MySQL

Step 3 of 7. Connect to PostgreSQL

To establish connection with PostgreSQL server you should specify the host and port to connect through. Host could be either network name or IP address. For local connections, you may leave this field empty or enter 127.0.0.1. The port value is necessary only if it differs from the default PostgreSQL port number 5432. Otherwise you may leave this field as is.

Enter user name and password or leave these fields blank for anonymous connection.

By default PostgreSQL server connects to database with name equal to the username specified. If there is no such database or PostgreSQL server does not allows access to it, custom database must be specified on this page.

Click the "Advance..." button to enter SSL settings if it is necessary:

  • CA Certificate - the file containing SSL certificate authority (CA) certificate(s). For example, when connecting to Azure Database for PostgreSQL with "Enforce SSL connection" enabled, you have to specify certificate BaltimoreCyberTrustRoot.crt from the installation folder of the product.
  • Revocation list - the file name of the SSL certificate revocation list (CRL). Certificates listed in this file, if it exists, will be rejected while attempting to authenticate the server's certificate.
  • Client Certificate - the file name of the client SSL certificate, replacing the default ~/.postgresql/postgresql.crt
  • Client Key - the location for the secret key used for the client certificate. It can either specify a file name that will be used instead of the default ~/.postgresql/postgresql.key, or it can specify a key obtained from an external engine (engines are OpenSSL loadable modules). An external engine specification should consist of a colon-separated engine name and an engine-specific key identifier.
Convert MySQL to PostgreSQL: Connect to Postgres

Step 4 of 7. Select Databases

On this wizard page the source and destination databases or PostgreSQL script file must be specified. Existing PostgreSQL database can be processed according to one of the following options:

  • Overwrite the entire database
  • Overwrite existing tables only
  • Skip existing tables
  • Merge
  • Synchronize

Existing PostgreSQL script file will be overwritten.

Also, users should select code page for the target PostgreSQL server.

Finally, the path to log file where execution traces will be written can be specified on this wizard page.

Migrate MySQL to PostgreSQL: Select Databases

Step 5 of 7. Conversion Settings

MySQL-to-PostgreSQL allows to customize migration via the following settings:

  • PostgreSQL schema - you can use existing schema (when merging data into existing database) or create new one.
  • Create tables LOGGED/UNLOGGED. Unlogged tables do not require writing data into write-ahead log that makes them considerably faster but not crash-safe.
  • Migrate data via INSERT/COPY statements. INSERT approach loads data row by row while COPY loads all the rows in one command. COPY is faster, but INSERT may give more diagnostic information in case of an issue.
  • "Do not migrate the data" - use this option if you need to convert only table definitions from MySQL to PostgreSQL.
  • "Make names case sensitive" - use this option to make table and column names case sensitive. In this case, names must be enclosed in quotes when composing a query.
Convert MySQL to PostgreSQL: Conversion Settings

Step 6 of 7. Select Tables

Select tables and compose filtering queries to migrate from MySQL to Postgres.

To add a table for migration, select it in "Available tables" list and click "Add" button (or double-click the selected item). Use "Add all" button to add all available tables. To remove a table from "Selected tables" list highlight it and click "Remove" button. Use "Remove all" button to remove all items from "Selected tables" list.

Use "Add Query" button for composing SELECT-query to filter data that will be migrated to PostgreSQL. See Using Queries article for the further information.

To edit table or query double click the corresponding item in "Selected tables" list box. If it is a table, dialog box appears to edit table attributes and to define custom type mapping. See Edit Table article for the further information. If selected item is a query, you will see dialog box to edit SQL-statement of the query.

Migrate MySQL to PostgreSQL: Select Tables

Step 7 of 7. Select Views

This wizard page is designed to select views for MySQL to Postgres migration.

To add MySQL view for converting it into PostgreSQL format, highlight it in "Available queries" list and click "Add" button (or double-click the selected item). Use "Add all" button to add all MySQL views. To remove an item from "Selected queries" list, highlight it and click "Remove" button (or double-click the selected item). Use "Remove all" button to remove all MySQL views from "Selected queries" list.

Sometimes it is important to convert views into PostgreSQL format according to the particular order (for example, to preserve dependencies). Use "up" and "down" buttons in right part of the wizard page to organize all queries in the appropriate order.

Convert MySQL to PostgreSQL: Select Views

Trial Version

Still not sure the program fits your needs to migrate from MySQL to Postgres? Try free demo version with limited features. It will allow you to convert only 50 records for each database table, it does NOT convert views and foreign keys. Test the quality of the demo and come back to place an order if satisfied with the results.

Download trial version of MySQL-to-PostgreSQL

Purchasing

MySQL-to-PostgreSQL is distributed through downloading from Intelligent Converters server only. Select the suitable software package in the table below and click the corresponding BUY NOW link. The product is covered by 30 day money-back guarantee.

MySQL-to-PostgreSQL
$79 BUY NOW
MySQL-to-PostgreSQL
$199 BUY NOW
MySQL-PostgreSQL Sync
bi-directional incremental synchronization
$79 BUY NOW
MySQL Migration Toolkit
migrate any data source to MySQL and vice versa
$149 BUY NOW