Migrating From MySQL to PostgreSQL Using pgloader
This tutorial shows how to migrate your mysql database to postgresql. Let’s imagine we are migrating a table called MusicData to PostgreSql from mysql
sudo mysqldump --compatible=postgresql --default-character-set=utf8 -r MusicData.mysql -u root -p MusicData sudo wget https://raw.github.com/lanyrd/mysql-postgresql-converter/master/db_converter.py sudo chmod +rx db_converter.py sudo python db_converter.py MusicData.mysql MusicData.psql
Install PostgreSQL if you don’t have it installed yet:
sudo apt-get install postgresql
Create your database to fill
sudo -u postgres psql
CREATE DATABASE "MusicData";
Quit out of the psql shell application by typing \q and hitting enter
Once you have your psql file, move it to the destination machine and run the following command:
sudo psql MusicData -U urPostgresUsr -h localhost < MusicData.psql