Setting up Mattermost for the first time on Unraid, unable to connect to mysql
I’m using the official script built on the community apps.
I installed mysql, and when I input the information into data source like so:
MMUSER:Password@tcp(127.0.0.1:3306)/MM_DATABASE?charset=utf8mb4,utf8\u0026readTimeout=30s\u0026writeTimeout=30s
I get:
{“timestamp”:“2024-12-24 20:13:36.703 -05:00”,“level”:“error”,“msg”:“Failed to ping DB”,“caller”:“sqlstore/store.go:270”,“database”:“master”,“dataSource”:“:@tcp(127.0.0.1:3306)/MM_DATABASE?charset=utf8mb4%2Cutf8%5Cu0026readTimeout%3D30s%5Cu0026writeTimeout%3D30s”,“retrying in seconds”:10,“error”:“dial tcp 127.0.0.1:3306: connect: connection refused”}
I also tried setting it to the IP and port that my server is running on, but then I get this error:
{“timestamp”:“2024-12-24 20:15:34.717 -05:00”,“level”:“error”,“msg”:“Failed to ping DB”,“caller”:“sqlstore/store.go:270”,“database”:“master”,“dataSource”:“:@tcp(192.168.1.254:3306)/MM_DATABASE?charset=utf8mb4%2Cutf8%5Cu0026readTimeout%3D30s%5Cu0026writeTimeout%3D30s”,“retrying in seconds”:10,“error”:“Error 1045 (28000): Access denied for user ‘MMUSER’@‘172.17.0.1’ (using password: YES)”}
I tried swapping to postgres, but it seems the setup is also a bit different.
I’m just testing this for a nonprofit to see if it’ll work for what we need, so I’m willing to try many things to get this to work.
Support for MySQL is being deprecated. Use PostgreSQL.
Your MySQL issues are probably A) an issue with the password (whenever this happens, I always suggest falling back to a very simple password, get it working, then make the password more complex); and B) you can allow the mysql user to connect on 127.0.0.1 but not localhost, or via hostname but not IP address.
Can you use psql to connect to your database? You need to make sure you’ve granted the appropriate permissions to your mattermost user, and that your pg_hba.conf allows TCP connections. Check every step in Prepare your Mattermost database - Mattermost documentation
Either there’s an issue with the script, UnRaid config, or there needs to be a specified Postgres version that needs to be used.
My guess is one of the first two, because in my situation, everything on the Postgres side is correct, I’m not sure if it needs to be installed into the same container, but I’m going to try that here in a bit.
well id really appreciate if you can let me know if you get it working and how you did it… ive had it working fine for over a year the old way with mysql but there is features that don’t work as im sure you are aware now.
If you cannot use psql from the Mattermost container, you’re networking is not right. 5432/TCP needs to be exposed on the postgres container to incoming connections.
I got it all figured out now… thanks… @rustybeef if you need a hand let me know… I know how to setup and configure it with unraid docker using Postgres
you need to use postgresql17 docker from the community apps,
when you install Mattermost from the community apps you need to change the Repository from mattermost/mattermost-team-edition:master to mattermost/mattermost-team-edition:latest
all the ports can stay default and your datasource should be like this postgres://yourusername:yourpassword@yourlocal_IP:5432/yourdatabaseusername?sslmode=disable&connect_timeout=10
(the username password and db name are what you set in postgresql17 docker)
App Host should be changed to your servers local IP
if you want to use the calls and screen share in mattermost you need to add Port for calls 8443 UDP
under more settings you need to change the MM_SQLSETTINGS_DRIVERNAME from mysql to Postgres