# Converting from MySQL to Postgres using NMIG

DevFeed: [Converting from MySQL to Postgres using NMIG](<https://devfeed.tech/articles/converting-from-mysql-to-postgres-using-nmig-28201.md>)

Original publisher: [Read original article](<http://fuzzyblog.io/blog/mysql/2020/09/22/converting-from-mysql-to-postgres-using-nmig.html>)

Author: Fuzzygroup

Published: 2020-09-22T00:11:00Z

Content type: tutorial

Language: en

Sources: [Scott Johnson](<https://devfeed.tech/sources/scott-johnson.md>)

Topics: [MySQL](<https://devfeed.tech/topics/mysql.md>), [Databases](<https://devfeed.tech/topics/databases.md>), [npm](<https://devfeed.tech/topics/npm.md>), [JavaScript](<https://devfeed.tech/topics/javascript.md>), [TypeScript](<https://devfeed.tech/topics/typescript.md>), [Git](<https://devfeed.tech/topics/git.md>)

Tags: [config](<https://devfeed.tech/tags/config.md>), [conversion](<https://devfeed.tech/tags/conversion.md>), [count](<https://devfeed.tech/tags/count.md>), [database](<https://devfeed.tech/tags/database.md>), [git](<https://devfeed.tech/tags/git.md>), [installation](<https://devfeed.tech/tags/installation.md>), [javascript](<https://devfeed.tech/tags/javascript.md>), [logs](<https://devfeed.tech/tags/logs.md>), [mysql](<https://devfeed.tech/tags/mysql.md>), [npm](<https://devfeed.tech/tags/npm.md>), [postgres](<https://devfeed.tech/tags/postgres.md>), [typescript](<https://devfeed.tech/tags/typescript.md>)

## AI overview

A practical guide to migrating a MySQL database to Postgres using the NMIG NPM tool. It covers installation, configuration, building the TypeScript code, running the conversion, and comparing row counts before and after migration.

## Source excerpt

Historically I've been a MySQL advocate but I've recently been quite impressed with Postgres. This leaves me in the position of needing to migrate several MySQL databases over to Postgres -or- run two database engines in production. And, clearly, it is far more desirable to run only a single production database server. I recently found the NPM tool NMIG and used it to successfully convert a MySQL database over to Postgres quickly and easily - once I got past the initial installation process. Installing and Using NMIG Here's what you need to do to use NMIG. Pro Tip 2: Go into your source database before you start the conversion and do a count on any table with a large number of records. This gives you a checksum on the overall process (NMIG has great logs but I always prefer belt and suspenders when it comes to working with valuable data). On your machine you need to have a version of NPM installed that is version 10 or later. Git clone the NMIG repo to a directory on your computer. Change into that directory. Edit the file config/config.json and set the credentials for your source and target. Make a directory named nmig_logs. Run npm install to install all the dependencies. Run npm run build to convert the code from TypeScript to JavaScript. Run the process with a syntax like this: npm start - -conf-dir='/Users/sjohnson/Sync/coding/my_x_is_y/nmig/config' -logs-dir='/Users/sjohnson/Sync/coding/my_x_is_y/nmig/nmig_logs' Note: Obviously you need to update your directories as needed. Pro Tip 2: Go into your target database after the conversion and do a count on the same table and compare the results with the above.