Acceldata
ODP

Last updated: Sep 24, 2026 15:55 UTC

Set up PostgreSQL as MLflow’s Backend Store

You can follow the below steps to set up PostgreSQL and configure it as the backend store for MLflow.


Steps to Setup

  • Install PostgreSQL.

On Ubuntu/Debian:

sudo apt update
sudo apt install postgresql postgresql-contrib

On CentOS/RHEL:

sudo yum install postgresql-server postgresql-contrib
sudo postgresql-setup initdb
sudo systemctl start postgresql
sudo systemctl enable postgresql
  • Switch to the Postgres user and enter the PostgreSQL shell.
sudo -i -u postgres
psql
  • Create a database and user for MLflow.
CREATE DATABASE mlflow;
CREATE USER mlflow WITH ENCRYPTED PASSWORD 'mlflow';
GRANT ALL PRIVILEGES ON DATABASE mlflow TO mlflow;
\q

Replace 'your_password' with a strong password.

  • Configure PostgreSQL to allow remote connections (optional)
  • Edit the PostgreSQL config file postgresql.conf to listen on all IPs:
sudo nano /etc/postgresql/<version>/main/postgresql.conf

Find the line:

Find the line:

Uncomment and change it to:

listen_addresses = '*'
  • Edit pg_hba.conf to allow your MLflow server IP (or all IPs):
sudo nano /etc/postgresql/<version>/main/pg_hba.conf
  • Add this line at the end (replace <mlflow_server_ip> with your MLflow server IP):
host mlflow_db mlflow_user <IP Address> md5
  • Restart PostgreSQL:
sudo systemctl restart postgresql