# Update My SQL a Postgre

**URL:** <https://forum.mattermost.com/t/update-my-sql-a-postgre/25519>\
**Category:** Uncategorized\
**Created:** [November 19, 2025, 10:49pm UTC](https://forum.mattermost.com/t/update-my-sql-a-postgre/25519 "2025-11-19T22:49:30Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![rrmfar](https://avatars.discourse-cdn.com/v4/letter/r/f6c823/32.png) [@rrmfar](https://forum.mattermost.com/u/rrmfar)\
**Post date:** [November 19, 2025, 10:49pm UTC](https://forum.mattermost.com/t/update-my-sql-a-postgre/25519/1 "2025-11-19T22:49:30Z")

</div>

Good afternoon, I’ve tried migrating from MySQL to PostgreSQL in every way possible and have only encountered one problem after another.

- I made a backup
- I downloaded the migration tool
- I tried using pgloader. However, the backup isn’t in the correct format, and the version of pgloader that installs isn’t the correct version because it has a bug. The steps I followed were:

sudo apt update  
sudo apt install postgresql-16 postgresql-client-16  
sudo -u postgres createuser -P mattermost  
sudo -u postgres createdb -O mattermost mattermostdb  
sudo apt install pgloader  
sudo mysqldump --databases mattermostdb \> mattermost.sql  
nano migrate.load  
LOAD DATABASE  
FROM mysql://root:your\_password@localhost/mattermostdb  
INTO postgresql://mattermost:your\_password@localhost/mattermostdb

WITH include drop, create tables, create indexes, reset sequences

SET work\_mem to ‘16MB’,  
maintenance\_work\_mem to ‘512 MB’,  
search\_path to 'publi  
CAST type datetime to timestamptz drop default drop not null,  
type timestamp to timestamptz drop default drop not null;  
pgloader migrate.load

However, the database won’t connect due to password incompleteness. It’s always one error after another. And since I have no experience, I’m completely lost. I’ve also tried installing DBeaver to migrate, but it gives me an error. Can you help me?

---

<div class="post-metadata">

**Author:** ![horned1](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mattermost.com/horned1/32/9294_2.png) [@horned1](https://forum.mattermost.com/u/horned1)\
**Post date:** [November 20, 2025, 7:06am UTC](https://forum.mattermost.com/t/update-my-sql-a-postgre/25519/2 "2025-11-20T07:06:12Z")

</div>

hello rrmfar, I just completed a migration and update of mattermost successfully (from mariadb via mysql to postgres-14) . The one thing that sticks out and that I don’t remember seeing in guides is importing the mysqldump into directly, .. you are installing pgloader, but not using it?

you want my step by step to test?

---

<div class="post-metadata">

**Author:** ![horned1](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mattermost.com/horned1/32/9294_2.png) [@horned1](https://forum.mattermost.com/u/horned1)\
**Post date:** [November 20, 2025, 7:09am UTC](https://forum.mattermost.com/t/update-my-sql-a-postgre/25519/3 "2025-11-20T07:09:55Z")

</div>

by ‘not using pgloader’ I mean the migration-assist part (I can see you use pgloader itself..)

./migration-assist postgres “postgres://mmuser:XXXXX@localhost:5432/mattermost?sslmode=disable” --run-migrations --mattermost-version=“10.8.0”  
dnf install pgloader  
./migration-assist pgloader --mysql=“mmuser:XXXXX@tcp(localhost:3306)/mattermost” --postgres=“postgres://mmuser:XXXXX@localhost:5432/mattermost?sslmode=disable” --remove-null-chars \> migration.load

It was my understanding that this migration.load contains what migrates from mysql to postgres, and it’s much more than just importing the database

---

<div class="post-metadata">

**Author:** ![Ng-M-Dat](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mattermost.com/ng-m-dat/32/9285_2.png) [@Ng-M-Dat](https://forum.mattermost.com/u/Ng-M-Dat)\
**Post date:** [November 20, 2025, 1:54pm UTC](https://forum.mattermost.com/t/update-my-sql-a-postgre/25519/4 "2025-11-20T13:54:17Z")

</div>

@[Horned1](https://forum.mattermost.com/u/horned1)  
PostgreSQL 14 using port: 5433 for default. (not be as port: 5432 before)  
Pls, check mattermost/config/config.json or /etc/postgresql/14/main/pg\_hba.conf to matching listen port.

---

<div class="post-metadata">

**Author:** ![rrmfar](https://avatars.discourse-cdn.com/v4/letter/r/f6c823/32.png) [@rrmfar](https://forum.mattermost.com/u/rrmfar)\
**Post date:** [November 21, 2025, 5:07pm UTC](https://forum.mattermost.com/t/update-my-sql-a-postgre/25519/5 "2025-11-21T17:07:34Z")

</div>

Si no te genero inconvenientes me gustaria tu ayuda para poder realizar el proceso. Gracias

---

<div class="post-metadata">

**Author:** ![horned1](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mattermost.com/horned1/32/9294_2.png) [@horned1](https://forum.mattermost.com/u/horned1)\
**Post date:** [November 24, 2025, 3:21pm UTC](https://forum.mattermost.com/t/update-my-sql-a-postgre/25519/6 "2025-11-24T15:21:18Z")

</div>

The step by step I successfully used (most of this is in the docs: [Automated PostgreSQL migration - Mattermost documentation](https://docs.mattermost.com/deployment-guide/postgres-migration-assist-tool.html) )

**Preparations**  
cd /tmp/  
wget [https://github.com/mattermost/migration-assist/releases/download/v0.5/migration-assist-Linux-x86\_64.tar.gz](https://github.com/mattermost/migration-assist/releases/download/v0.5/migration-assist-Linux-x86_64.tar.gz)  
tar -xvf migration-assist-Linux-x86\_64.tar.gz  
dnf install pgloader  
dnf install -y [https://download.postgresql.org/pub/repos/yum/reporpms/EL-9-x86\_64/pgdg-redhat-repo-latest.noarch.rpm](https://download.postgresql.org/pub/repos/yum/reporpms/EL-9-x86_64/pgdg-redhat-repo-latest.noarch.rpm)  
dnf install postgresql14-server.x86\_64 postgresql14.x86\_64 postgresql14-contrib.x86\_64 --nobest  
/usr/pgsql-14/bin/postgresql-14-setup initdb  
systemctl start postgresql-14  
systemctl enable postgresql-14

systemctl stop mattermost

**Start the migration**

./migration-assist mysql “mmuser:XXX@tcp(localhost:3306)/mattermost” --fix-artifacts --fix-unicode --fix-varchar

**in the guide there is a single command you are supposed to run, but after finfing this info on some forums I did all these commands separately and it solved my issues**  
[root@mattermost:/tmp]# sudo -u postgres psql  
psql (14.19)  
Type “help” for help.

postgres=# create database mattermost;  
CREATE DATABASE  
postgres=# CREATE USER mmuser WITH PASSWORD ‘XXX’;  
CREATE ROLE  
postgres=# GRANT ALL PRIVILEGES ON DATABASE mattermost to mmuser;  
GRANT  
postgres=# ALTER DATABASE mattermost OWNER TO mmuser;  
ALTER DATABASE  
postgres=# GRANT USAGE, CREATE ON SCHEMA PUBLIC TO mmuser;  
GRANT  
postgres=# \c mattermost;  
You are now connected to database “mattermost” as user “postgres”.  
mattermost=# SELECT current\_database();  
current\_database

mattermost  
(1 row)

mattermost=# ALTER SCHEMA public OWNER to mmuser;  
ALTER SCHEMA  
mattermost=# GRANT ALL ON SCHEMA public to mmuser;  
GRANT  
mattermost=# \q

**the command below should have your own mattermost version of course**  
./migration-assist postgres “postgres://mmuser:XXX@localhost:5432/mattermost?sslmode=disable” --run-migrations --mattermost-version=“10.8.0”  
./migration-assist pgloader --mysql=“mmuser:XXX@tcp(localhost:3306)/mattermost” --postgres=“postgres://mmuser:XXX@localhost:5432/mattermost?sslmode=disable” --remove-null-chars \> migration.load

pgloader migration.load \> migration.log

./migration-assist postgres post-migrate --create-indexes “postgres://mmuser:XXX@localhost:5432/mattermost?sslmode=disable”  
./migration-assist pgloader boards --mysql=“mmuser:XXX@tcp(localhost:3306)/mattermost” --postgres=“postgres://mmuser:XXX@localhost:5432/mattermost?sslmode=disable” \> boards.load  
./migration-assist pgloader playbooks --mysql=“mmuser:XXX@tcp(localhost:3306)/mattermost” --postgres=“postgres://mmuser:XXX@localhost:5432/mattermost?sslmode=disable” \> playbooks.load  
./migration-assist pgloader calls --mysql=“mmuser:XXX@tcp(localhost:3306)/mattermost” --postgres=“postgres://mmuser:XXX@localhost:5432/mattermost?sslmode=disable” \> calls.load

pgloader boards.load \> boards\_migration.log  
pgloader playbooks.load \> playbooks\_migration.log  
pgloader calls.load \> calls\_migration.log

**set the sql connector to PSQL and change the unit-file to point to PostgreSQL as in the guide**  
vi /opt/mattermost/config/config.json  
vi /etc/systemd/system/mattermost.service

**Start and check for errors**  
systemctl start mattermost  
journalctl -xeu mattermost.service

**Then update as in docs ( [Upgrade Mattermost Server - Mattermost documentation](https://docs.mattermost.com/administration-guide/upgrade/upgrading-mattermost-server.html) )**  
wget [https://releases.mattermost.com/11.1.0/mattermost-11.1.0-linux-amd64.tar.gz](https://releases.mattermost.com/11.1.0/mattermost-11.1.0-linux-amd64.tar.gz)  
tar -xvf mattermost-11.1.0-linux-amd64.tar.gz mattermost/  
systemctl stop mattermost  
cd /opt/  
cp -ra mattermost/ mattermost-back-$(date +‘%F-%H-%M’)/  
sudo find mattermost/ mattermost/client/ -mindepth 1 -maxdepth 1 ! ( -type d ( -path mattermost/client -o -path mattermost/client/plugins -o -path mattermost/config -o -path mattermost/logs -o -path mattermost/plugins -o -path mattermost/data ) -prune ) | sort | sudo xargs rm -r

cp -an /tmp/mattermost/. mattermost/  
chown -R mattermost:mattermost mattermost  
setcap cap\_net\_bind\_service=+ep ./mattermost/bin/mattermost

systemctl start mattermost  
journalctl -xeu mattermost.service

**Finally the forumposts I used at some point soving this issue for me**  
search path error

> [@Migration-assist tool hits a roadblock - migrating from mysql 8 to postgresql 15--Cannot connect to migrated postgresql db](https://forum.mattermost.com/t/migration-assist-tool-hits-a-roadblock-migrating-from-mysql-8-to-postgresql-15-cannot-connect-to-migrated-postgresql-db/19256/4):
>
> Thank you to [Agniva De Sarker](https://forum.mattermost.com/u/agnivade) — your suggestion worked! I have hit another problem now and I hope there is some solution. I was able to complete the other data migration steps. But I cannot seem to get Mattermost to start up with the new postgres config.json settings. I’m using: "SqlSettings": { "DriverName": "postgres", "DataSource": "postgres://mmuser:secretpassword@127.0.0.1:5432/mattermost?sslmode=disable\u0026connect\_timeout=10", …it errors with logs like this: – The job iden…

config that was depricated  
[https://support.mattermost.com/hc/en-us/articles/42915463550996-Mattermost-11-x-Upgrade-Error-Hidden-Archived-Channels](https://support.mattermost.com/hc/en-us/articles/42915463550996-Mattermost-11-x-Upgrade-Error-Hidden-Archived-Channels)

---

<div class="post-metadata">

**Author:** ![rrmfar](https://avatars.discourse-cdn.com/v4/letter/r/f6c823/32.png) [@rrmfar](https://forum.mattermost.com/u/rrmfar)\
**Post date:** [November 25, 2025, 6:42pm UTC](https://forum.mattermost.com/t/update-my-sql-a-postgre/25519/7 "2025-11-25T18:42:13Z")

</div>

I sincerely appreciate the steps you provided; however, I am running everything on Ubuntu 24. I installed the tool via `sudo apt install pgloader`, but it installed a version that reports compatibility issues with MySQL. From that point onward, the repositories are misconfigured, and I inevitably encounter the same problems again.

```bash
cd /tmp/
wget https://github.com/mattermost/migration-assist/releases/download/v0.5/migration-assist-Linux-x86_64.tar.gz
tar -xvf migration-assist-Linux-x86_64.tar.gz
sudo apt install pgloader
sudo sh -c 'wget -O /etc/apt/trusted.gpg.d/pgdg.asc https://www.postgresql.org/media/keys/ACCC4CF8.asc'
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
sudo apt update
sudo apt install postgresql-14
sudo systemctl status postgresql # Confirmed operational
systemctl stop mattermost
./migration-assist mysql "mmuser:rg22090801@tcp(localhost:3306)/mattermost" --fix-artifacts --fix-unicode --fix-varchar

```

The database creation and permission assignments executed flawlessly.

```bash
./migration-assist postgres post-migrate --create-indexes "postgres://mmuser:XXX@localhost:5432/mattermost?sslmode=disable"
./migration-assist pgloader boards --mysql="mmuser:XXX@tcp(localhost:3306)/mattermost" --postgres="postgres://mmuser:XXX@localhost:5432/mattermost?sslmode=disable" > boards.load
./migration-assist pgloader playbooks --mysql="mmuser:XXX@tcp(localhost:3306)/mattermost" --postgres="postgres://mmuser:XXX@localhost:5432/mattermost?sslmode=disable" > playbooks.load
./migration-assist pgloader calls --mysql="mmuser:XXX@tcp(localhost:3306)/mattermost" --postgres="postgres://mmuser:XXX@localhost:5432/mattermost?sslmode=disable" > calls.load

```

However, the following errors occurred during execution:

```auto
2025-11-25T18:21:31.032000Z LOG pgloader version "3.6.7~devel"
2025-11-25T18:21:31.317003Z LOG Migrating from #<MYSQL-CONNECTION mysql://mmuser@localhost:3306/mattermost {1006EA2D33}>
2025-11-25T18:21:31.317003Z LOG Migrating into #<PGSQL-CONNECTION pgsql://mmuser@localhost:5432/mattermost {1006EA2F23}>
2025-11-25T18:21:31.384004Z ERROR mysql: Failed to connect to mysql at "localhost" (port 3306) as user "mmuser": Condition QMYND:MYSQL-UNSUPPORTED-AUTHENTICATION >
2025-11-25T18:21:31.412004Z ERROR Database error 42P01: relation "mattermost.focalboard_blocks" does not exist
QUERY: UPDATE mattermost.focalboard_blocks SET "fields" = '{}'::json WHERE "fields"::text = '';

```

Thereafter, I was unable to proceed further—encountering persistent errors while attempting to restart the service. I even performed system updates and switched the database connection to PostgreSQL, yet the issues persisted.

---

<div class="post-metadata">

**Author:** ![horned1](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mattermost.com/horned1/32/9294_2.png) [@horned1](https://forum.mattermost.com/u/horned1)\
**Post date:** [November 26, 2025, 11:30am UTC](https://forum.mattermost.com/t/update-my-sql-a-postgre/25519/8 "2025-11-26T11:30:11Z")

</div>

That authentication error.. The problem is that currently _pgloader_ doesn’t support `caching_sha2_password` authentication plugin, which is default for MySQL 8, whereas older MySQL versions use `mysql_native_password` plugin.

> <https://stackoverflow.com/questions/56542036/pgloader-failed-to-connect-to-mysql-at-localhost-port-3306-as-user-root>

---

<div class="post-metadata">

**Author:** ![horned1](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mattermost.com/horned1/32/9294_2.png) [@horned1](https://forum.mattermost.com/u/horned1)\
**Post date:** [November 26, 2025, 11:31am UTC](https://forum.mattermost.com/t/update-my-sql-a-postgre/25519/9 "2025-11-26T11:31:46Z")

</div>

Also the error that the focalboards is missing is likely because of an error in migrating the ‘boards’ part, check the boards\_migration.log for errors

If you are using MariaDB instead of Mysql (as I did) this is where my migration failed, some timestamps in focalboards has the wrong syntax on mariadb
