First time here? Check out the FAQ!

How to migrate from MySQL to PostgresQL?

Hello, is it possible to switch the database backend to postgres? Is there a simple protocol?

techlawyer's avatar
asked 2010-12-18 01:02:57 -0500
edit flag offensive 0 remove flag close merge delete


Hi, there is a simple method. Will respond tomorrow in the morning. Thanks for your interest.
Evgeny's avatar Evgeny (2010-12-18 01:46:10 -0500) edit
add a comment see more comments

1 Answer


PostgresQL has excellent support of the full text search and transactions that help prevent data inconsistency issues when the software on the server fail. Askbot has also been tested with MySQL and works well but with a significant limitation - only MyISAM storage engine works with Askbot. MyISAM engine is the only MySQL storage engine supporting the full text indexing, but it does not understand transactions. So - PostgresQL is a much better choice of the database to run askbot forum.

To switch from MySQL to PostgresQL, create a new PostgresQL database then follow the steps shown below.

First open a shell window in the directory that contains the file - the site project directory.

Run a command to save the current forum data:

python dump_forum

You will be asked a question how to name the dump - and a file with that name and extension .json will be saved in the current working directory, suppose it's about-cats.json. The file extension will be added automatically.

Change the database settings in the file so that the site uses the new postgresql database:

DATABASE_ENGINE = 'postgresql_psycopg2' #also change the user name and password

Initialize the tables for the forum:

python syncdb
python migrate

Finally, load the data:

python load_forum about-cats.json

See how your forum works with the PostgresQL database:

python runserver `hostname -i`:8000
Evgeny's avatar
answered 2010-12-18 13:46:09 -0500
edit flag offensive 0 remove flag delete link


It doesn't work with my site. It says Unknown command:'dump_forum' what should I do? thanks @Evgeny

Andy's avatar Andy (2016-04-01 01:15:19 -0500) edit
add a comment see more comments