Migrating from MS SQL to PostgreSQL or from MySQL to PostgreSQL

PostgreSQL  is another strong widely used companion in addition to MySQL in the field of free and open source softwares (FOSS). PostgreSQL also has extension names PostGIS which is specially designed to handle Map data efficiently. If you have your existing data in MS SQL or MySQL and want to migrate it to PostgreSQL then follow the following steps-:

  • Firstly, if you are migrating from MS SQL , then migrate your database to MySQL . You can follow my previous post for details. Here is the link of the post Migrating from MS SQL to MySQL.
  • After migrating to MySQL download and install PostgreSQL if not already in your pc from the PostgreSQL website. Ready to install (.bin) files for Linux and .exe files for Windows are available to download.
  • When installation of PostgreSQL is completed it will ask you for adding additional components. Continue on this window by clicking on Next button. If you already have PostgreSQL installed on your pc then start PostgreSQL Application Stack Builder from Start Menu in case of Windows or from Applications Menu in case of Linux. You can also use following command under Linux

#{PostgreSQL installation path}/scripts/launchstackbuilder.sh

Select your server on first Screen and click on Next.

  • Now select EnterpriseDB MySQL migration wizard under Registration required add-ons as shown in following screenshot-:
  • You have to register on PostgreSQL website for installing the above add-on . Then follow on screen options to complete installation.
  • Now run the Migration Wizard from  Linux (Applications–>PostgreSQL Plus Add-ons –>Migration Wizard) or from Windows (Start Menu –>PostgreSQL Plus Add-ons –> Migration Wizard). Below is Screenshot of Migration Wizard-:
  • Now fill in the various fields according to your configuration and then follow on screen instructions to complete the migration process
  • After migrating data you can use phpPgAdmin or pgAdmin graphical tools to log in to your database and verify the transfer process.