# Migration from MySQL 8 to Postgres Database

**URL:** <https://forum.mattermost.com/t/migration-from-mysql-8-to-postgres-database/17166>\
**Category:** Troubleshooting\
**Created:** [October 27, 2023, 7:32am UTC](https://forum.mattermost.com/t/migration-from-mysql-8-to-postgres-database/17166 "2023-10-27T07:32:09Z")\
**Posts on this page:** 1\
**Showing post:** 9

<div class="post-metadata">

**Author:** ![Akshaychdev](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mattermost.com/akshaychdev/32/5255_2.png) [@Akshaychdev](https://forum.mattermost.com/u/Akshaychdev)\
**Post date:** [November 7, 2023, 6:27am UTC](https://forum.mattermost.com/t/migration-from-mysql-8-to-postgres-database/17166/9 "2023-11-07T06:27:10Z")

</div>

Hi @gdelia-pm, glad that you worked it out. I actually lost track of it, but I restarted the migration from the beginning. Currently, the source MySQL8 DB has the mattermost schema corresponding to version 8.1.  
I’m following the steps you mentioned,

1. I’ve created a new database and user with the postgres docker init, as per the [prepare database documentation](https://docs.mattermost.com/install/prepare-mattermost-database.html).

2. Created new load file `mm_posts.load` and ran the pgloader command with `pgloader mm_posts.load > migration.log`, but getting error,

3. Assuming It is because of the posts tables missing issue, I ve ran the `morph` migrations again after cloning the mattermost `release-8.1`.

4. I’ve now altered the `ALTER TABLE public.posts **` =\> `ALTER TABLE mattermost.posts** ` in `mm_posts.load`, rebuild the database. Then run the morph command to build up the post schema. Retried the `posts` table only migration (`mm_posts.load`),

Can you suggest what I’m missing? I know it is some simple thing I’ve overlooked. Thanks in advance.

---

_[View the full topic](https://forum.mattermost.com/t/migration-from-mysql-8-to-postgres-database/17166)._
