Migrating from MySQL to Postgres

Dump your database:

mysqldump --compatible=postgresql --default-character-set=utf8 -r databasename.mysql -u root databasename  

Convert the dump to Postgres syntax using https://github.com/lanyrd/mysql-postgresql-converter:

wget https://raw.github.com/lanyrd/mysql-postgresql-converter/master/db_converter.py  chmod +rx db_converter.py  python db_converter.py databasename.mysql databasename.psql  

Install postgres:

apt-cache search postgres # find the most recent  sudo apt-get install postgresql-x.x  

Create the database and insert the data:

sudo -u postgres createdb databasename  psql databasename -U postgres -h 127.0.0.1 < databasename.psql

Popular posts from this blog

Shrink you container size up to 95%.

alma linux: dnf Module yaml error: Unexpected key in data