How to install metabase and connect MySQL DB

Metabase is an open source business intelligence tool. It lets you ask questions about your data, and displays answers in formats that make sense, whether that’s a bar graph or a detailed table.

You can explore their product from here

Installing Metabase

Metabase can be installed by several ways.

Personally i prefer to use the docker example because it’s easier in the installation of metabase and also can be installed anywhere.

Install Docker and prepare the environment

Before installing metabase, it’s crucial to install and configure docker and it’s the only dependency needed after that it’s straight forward.

Copy the following lines if you’re using ubuntu.

sudo apt-get update
sudo apt-get install ca-certificates curl gnupg lsb-release
curl -fsSL <> | sudo gpg --dearmor-o /usr/share/keyrings/docker-archive-keyring.gpg
echo \\
"deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker archive-keyring.gpg] <> \\
$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli

For the full installation documentation check ubuntu installation here

For centos check

You can choose other distros from the side menu as shown in the screenshot

Run the container

now you need to pull the image and create the container.

docker run -d -p 3000:3000 --name metabase metabase/metabasedocker ps -a

Access Metabase

now open your browser and write down http://localhost:3000 and metabase will be opened.

if you’re installing metabase on a cloud server you can access it http://IP:3000 and in production you may need to point a domain and configure nginx reverse proxy to proxy requests to port 3000 or the port you choose.

Install and configure DB

sudo apt install mysql-serversudo mysql_secure_installation   #Configure strong security controls by choosing 2 and press yes for all choices.
  • login to MySQL
mysql -u root
  • Then inside MySQL configure database
  • create a user
  • create DB
  • assign permissions to the user
  • commit your configurations
CREATE USER 'metabaseuser'@'%' IDENTIFIED BY 'P@ssw0rd';
GRANT ALL PRIVILEGES ON metabasedb.* TO 'metabaseuser'@'%'; #Make sure to grant access to only one databse and not whole MySQL server

MySQL Access Permissions

open mysql config to modify the bind address, which is the only address whitelisted to access the DB

sudo nano /etc/mysql/mysql.conf.d/mysqld.cnf
  • You’ll have the below view. Change the bind to be instead of to enable any IP/source to access the DB or specify the metabase IP.

Connect the DB to Metabase

  • Open metabase web interface localhost:<port number> and click on Let’s get started.
  • In step 3 you connect the DB
  • choose MySQL
  • and then, fill the data as below (for the host replace the IP with host public IP)
  • for other data modify them according to your configuration.

Leave a Comment