Configure the Mattermost Database for your self-hosted deployment

Terminal Commands


Access your PostgreSQL v11+ database

sudo -u postgres psql


Create the Mattermost database

CREATE USER mmuser WITH PASSWORD 'mmuser-securepassword';

CREATE DATABASE mattermost;


Grant the user access to the Mattermost database

GRANT ALL PRIVILEGES ON DATABASE mattermost to mmuser;

ALTER DATABASE mattermost OWNER TO mmuser;

/q


PostgreSQL v15 only: Create schema permissions 

GRANT USAGE, CREATE ON SCHEMA PUBLIC TO mmuser;

/q


High availability & multi-server deployments

/etc/postgresql/VERSION/main/postgresql.conf


Ensure only Mattermost Server can connect to the PostgreSQL port

Edit the postgresql.conf file and update the listen_addresses line to *: listen_addresses = '*'

sudo systemctl restart postgresql

Configure database connections

/etc/postgresql/VERSION/main/pg_hba.conf

  • peer > trust
  • scram-sha-256 > trust

Reload PostgreSQL

sudo systemctl reload postgresql


Verify you can connect with the user mmuser

Single server

psql -U mmuser mattermost

Multi-Server

psql --host={postgres-server-IP} --dbname=mattermost --username=mmuser --password


Exit the PostgreSQL terminal

\q

Test your knowledge

If you liked this video, watch these next!

Want to learn more?

Visit the following Mattermost product documentation pages for details:


Share your ideas!

What Mattermost admin topics do you want to see covered in a training video? Share your feedback with us at [email protected].

Complete and Continue  
Discussion

0 comments