# Upgrade from 10 to 11 postgres update from v.13 db restore issue

**URL:** <https://forum.mattermost.com/t/upgrade-from-10-to-11-postgres-update-from-v-13-db-restore-issue/25320>\
**Category:** Upgrade\
**Created:** [October 16, 2025, 9:56am UTC](https://forum.mattermost.com/t/upgrade-from-10-to-11-postgres-update-from-v-13-db-restore-issue/25320 "2025-10-16T09:56:26Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![ollejacobsen](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mattermost.com/ollejacobsen/32/9224_2.png) [@ollejacobsen](https://forum.mattermost.com/u/ollejacobsen)\
**Post date:** [October 16, 2025, 9:56am UTC](https://forum.mattermost.com/t/upgrade-from-10-to-11-postgres-update-from-v-13-db-restore-issue/25320/1 "2025-10-16T09:56:26Z")

</div>

Hi.

We are running a Mattermost instance with docker compose.

Basically we are using the this [.env-file](https://github.com/mattermost/docker/blob/main/env.example)

Currently we are running with  
`MATTERMOST_IMAGE_TAG=10.12`  
`POSTGRES_IMAGE_TAG=13-alpine`

I saw that version mattermost version 11 needs Postgres 14 or higher so I thought I should upgrade to Postgres 16.

I basically run these commands to make a sql-backup and try to restore.  
**Backup**

1. Shut down the stack `docker compose down`
2. Start only the postgres container `docker compose up -d postgres`
3. Create a backup `docker exec -it docker-postgres-1 pg_dumpall -U mmuser > ./backup/postgres13-update-backup.sql`
4. Stop the db container `docker stop docker-postgres-1`

**Restore**

1. Adjust .env file  
`POSTGRES_IMAGE_TAG=16-alpine`  
`POSTGRES_DATA_PATH=./volumes/db16/var/lib/postgresql/data`
2. Bring up the db container only `docker compose up -d postgres`
3. Import the data `docker exec -i docker-postgres-1 psql -U mmuser < ./backup/postgres13-update-backup.sql`

When running step 3 i get `psql: error: connection to server on socket “/var/run/postgresql/.s.PGSQL.5432” failed: FATAL: database “mmuser” does not exist`

I know this is more of a docker/postgres issue but I’m reaching out here first. I’m not very good at these things.

Any ideas?

Kind regards,  
Olle

---

<div class="post-metadata">

**Author:** ![mpounsett](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mattermost.com/mpounsett/32/4056_2.png) [@mpounsett](https://forum.mattermost.com/u/mpounsett)\
**Post date:** [October 16, 2025, 5:40pm UTC](https://forum.mattermost.com/t/upgrade-from-10-to-11-postgres-update-from-v-13-db-restore-issue/25320/2 "2025-10-16T17:40:25Z")

</div>

I’m not using docker for production, but I do use it in a test instance for some internal tools development work. My guess is your compose file isn’t setting up the right user in your postgres container. This is what I have in my `docker-compose.yml` for the PG server:

```yaml
services:
  db:
    image: postgres:15
    environment:
      POSTGRES_USER: mmuser
      POSTGRES_PASSWORD: mmuserpass
      POSTGRES_DB: mattermost
    volumes:
      - dbdata:/var/lib/postgresql/data
    ports: ["55432:5432"]

```

---

<div class="post-metadata">

**Author:** ![ollejacobsen](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mattermost.com/ollejacobsen/32/9224_2.png) [@ollejacobsen](https://forum.mattermost.com/u/ollejacobsen)\
**Post date:** [October 17, 2025, 7:35am UTC](https://forum.mattermost.com/t/upgrade-from-10-to-11-postgres-update-from-v-13-db-restore-issue/25320/3 "2025-10-17T07:35:10Z")

</div>

I found the issue in “Restore step 3“  
I needed to supply the database as well. So the command becomes:

`docker exec -i docker-postgres-1 psql -U mmuser -d mattermost < ./backup/postgres13-update-backup.sql`  
Note the `... -d mattermost ...` param.

If I bring up the stack now with .env `MATTERMOST_IMAGE_TAG=11.0`  
I get a new error `Error: failed to initialize platform: cannot create store: error setting up connections: pq: password authentication failed for user “mmuser”`

I guess I need to work some more with the DB-backup / restore commands.

Or are there some official documentation from Mattermost how to migrate that I’ve missed?  
(Since I’m using the example docker compose pattern)

---

<div class="post-metadata">

**Author:** ![TessaWynn](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mattermost.com/tessawynn/32/9221_2.png) [@TessaWynn](https://forum.mattermost.com/u/TessaWynn)\
**Post date:** [October 17, 2025, 7:54am UTC](https://forum.mattermost.com/t/upgrade-from-10-to-11-postgres-update-from-v-13-db-restore-issue/25320/4 "2025-10-17T07:54:03Z")

</div>

Hello! i am interested because this website is very helpful for everyon.

---

<div class="post-metadata">

**Author:** ![ollejacobsen](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mattermost.com/ollejacobsen/32/9224_2.png) [@ollejacobsen](https://forum.mattermost.com/u/ollejacobsen)\
**Post date:** [October 17, 2025, 8:31am UTC](https://forum.mattermost.com/t/upgrade-from-10-to-11-postgres-update-from-v-13-db-restore-issue/25320/5 "2025-10-17T08:31:35Z")

</div>

Here is my working solution

**Backup**

1. Shut down the stack `docker compose down`

2. Start only the postgres container `docker compose up -d postgres`

3. Create a backup  
`docker exec -it docker-postgres-1 pg_dump mattermost -U mmuser --no-privileges > ./backup/postgres13-update-backup.sql`

4. Stop the db container `docker stop docker-postgres-1`

**Restore**

1. Adjust .env file  
`POSTGRES_IMAGE_TAG=16-alpine`  
`POSTGRES_DATA_PATH=./volumes/db16/var/lib/postgresql/data`

2. Bring up the db container only `docker compose up -d postgres`

3. Remove existing db:s  
`docker exec -it docker-postgres-1 dropdb mattermost -U mmuser`  
`docker exec -it docker-postgres-1 createdb mattermost -U mmuser`

4. Import the data  
`docker exec -i docker-postgres-1 psql -U mmuser -d mattermost < ./backup/postgres13-backup-mattermost.sql`

**Update Mattermost**

1. Adjust .env file  
`MATTERMOST_IMAGE_TAG=11.0`
2. Bring up the stack (in my case)  
`docker compose -f docker-compose.yml -f docker-compose.without-nginx.yml up -d`

---

<div class="post-metadata">

**Author:** ![proxycon](https://avatars.discourse-cdn.com/v4/letter/p/e9bcb4/32.png) [@proxycon](https://forum.mattermost.com/u/proxycon)\
**Post date:** [October 19, 2025, 10:03pm UTC](https://forum.mattermost.com/t/upgrade-from-10-to-11-postgres-update-from-v-13-db-restore-issue/25320/6 "2025-10-19T22:03:30Z")

</div>

Hey @ollejacobsen , thank you for the nice instructions.  
I have a few improvements, that I unfortunately had to experience the hard way (data loss) - absolutely my own fault and just in a hobby project but maybe this can help others.

1. The name of the backup file (`./backup/postgres13-update-backup.sql`) and the restored file (`./backup/postgres13-backup-mattermost.sql`) do NOT match. These should be the same
2. make sure that the output of the backup step is written to console as well (e.g. using `| tee`) - I had a typo in the backup and did not notice because the error was just written into the backup file
3. should be common sense, but maybe add a step to check the backup content - I did not against better judgement. at least if there are some sensible looking lines in the sql dump

Thanks again for your effort of documenting the upgrade instructions 🙂
