Topic on Project:Support desk

Migrating MYSQL to PSQL database

8
Iradum (talkcontribs)

Hello,

In this weekend I've tried to migrate a mediawiki server, to a new one.

My main problem is to migrate the database, from MYSQL to PSQL. Is there any solution to move all the data from one database to another, without losing data? I've tried to convert it using pgloader, but without success.

I tried to import and export all the images, posts and users but i have a problem at UserExport plugin too.

Thank you for help!

Malyacko (talkcontribs)

Is "PSQL" the same as "PostgreSQL"?

Iradum (talkcontribs)

Hello Malyacko,

Yes, is a PostgreSQL server. Sorry for abbreviations.

Ciencia Al Poder (talkcontribs)

Sadly, PostgreSQL has also some differences in schema, like for example the user table which is named "mwuser" in PostgeSQL.

Iradum (talkcontribs)

Thanks Ciencia.

Than, is there any way to move all the content from one database to another one without losing data?

Maybe using importing and exporting plugins? I observe that UserExport plugin is not working on version 1.25, the version that is running on the old server. I could try to upgrade it (to 1.27 or newer) and try to export them after.

After this I can try to export all the images and all the pages, but i'm not sure if in this process we will lose some information.

Ciencia Al Poder (talkcontribs)

I'm not sure if there's documentation somewhere about the schema differencies between PSQL and mysql, which you could use to rename tables or fields as needed. the mwuser table is one of them that I'm aware of. You can try doing that change on your converted database and see if there's something else that breaks...

Another option can be to install MediaWiki on a new PSQL database just to create the schema, and then try to import the data from the old database. If you encounter errors, those would be from differencies in schema, that you can fix as you encounter them. Be sure to use the same MediaWiki version your're using now, to not introduce schema differencies caused by a version upgrade. Then you could do a normal MediaWiki upgrade to get the latest version.

Iradum (talkcontribs)

Thanks Ciencia!

I will try this approach.

Bovender (talkcontribs)

@Iradum, sorry for reviving this old thread, but did you ever manage to migrate to Postgres? I'm struggling with it too, using pgloader. Thanks.

Reply to "Migrating MYSQL to PSQL database"