Installing MySQL Database Server

Install and set up the database for use by the Mattermost server. You can install either MySQL or PostgreSQL.

To install MySQL on Debian Buster:

  1. Log into the server that will host the database, and open a terminal window.

  2. Download the MySQL repository package.


  1. Install the repository

sudo dpkg -i mysql-apt-config*

  1. Update your local package list.

sudo apt-get update

  1. Add the MySQL repo MySQL.

sudo apt-get install mysql-server


During the install, you’ll be prompted to create a password for the MySQL root user. Make a note of the password because you’ll need it in the next step.

  1. Log in to MySQL as root.

mysql -u root -p

When prompted, enter the root password that you created when installing MySQL.

  1. Create the Mattermost user ‘mmuser’.

mysql> create user 'mmuser'@'%' identified by 'mmuser-password';


  1. Use a password that is more secure than ‘mmuser-password’.

  2. The ‘%’ means that mmuser can connect from any machine on the network. However, it’s more secure to use the IP address of the machine that hosts Mattermost. For example, if you install Mattermost on the machine with IP address, then use the following command:

mysql> create user 'mmuser'@'' identified by 'mmuser-password';

  1. Create the Mattermost database.

mysql> create database mattermost;

  1. Grant access privileges to the user ‘mmuser’.

mysql> grant all privileges on mattermost.* to 'mmuser'@'%';

  1. Log out of MySQL.

mysql> exit

With the database installed and the initial setup complete, you can now install the Mattermost server.