# \[Solved\] Migration from mysql to postgresql failure--migration mismatch

**URL:** <https://forum.mattermost.com/t/solved-migration-from-mysql-to-postgresql-failure-migration-mismatch/25143>\
**Category:** Uncategorized\
**Created:** [August 25, 2025, 3:46pm UTC](https://forum.mattermost.com/t/solved-migration-from-mysql-to-postgresql-failure-migration-mismatch/25143 "2025-08-25T15:46:24Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![cfasano](https://avatars.discourse-cdn.com/v4/letter/c/97f17d/32.png) [@cfasano](https://forum.mattermost.com/u/cfasano)\
**Post date:** [August 25, 2025, 3:46pm UTC](https://forum.mattermost.com/t/solved-migration-from-mysql-to-postgresql-failure-migration-mismatch/25143/1 "2025-08-25T15:46:24Z")

</div>

I am stuck. I’ve been following the guide, but I run

“postgres://mmuser:mypassword@localhost:5432/mattermost” --run-migrations --migrations-dir migrationsdir --check-schema-owner=false

I get the error “An Error Occurred: could not run migrations: could not apply migrations: migration mismatch, there are more migrations applied than those were specified in source”

I’ve tried feeding the mysql.output in directly by adding

–applied-migrations mysql.output

…but to no avail. Any thought, anyone? This migration as been awful. Up until now, mattermost has been smooth as silk.

Best,

Chris

---

<div class="post-metadata">

**Author:** ![cfasano](https://avatars.discourse-cdn.com/v4/letter/c/97f17d/32.png) [@cfasano](https://forum.mattermost.com/u/cfasano)\
**Post date:** [August 26, 2025, 3:52pm UTC](https://forum.mattermost.com/t/solved-migration-from-mysql-to-postgresql-failure-migration-mismatch/25143/2 "2025-08-26T15:52:20Z")

</div>

Okay–I figured it out. The migrate.log file indicated that there were problems migrating the mysql into the new postgres mattermost database because of existing entries in the mattermost tables (usually conflicting/existing keys). I had to empty all the tables in the new mattermost postgress with a command like “truncate table name1, name2, …,lastname cascade; Here all the names are the table names that you can see by looking at the mattermost database while logged in as mmuser with a command like psql -h localhost -d mattermost -U mmuser. Everything worked and I’m logged in now to my newly migrated mattermost.

---

<div class="post-metadata">

**Author:** ![john.combs](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mattermost.com/john.combs/32/7118_2.png) [@john.combs](https://forum.mattermost.com/u/john.combs)\
**Post date:** [August 26, 2025, 7:12pm UTC](https://forum.mattermost.com/t/solved-migration-from-mysql-to-postgresql-failure-migration-mismatch/25143/3 "2025-08-26T19:12:29Z")

</div>

Thanks for sharing the resolution, Chris! Glad you’re up and running! 🙌🏻
