Run Metabase Docker with MySQL APP DB

Hi Team,
Can I run Metabase docker with MySQL database.
I am looking for the documentation but only find the Postgres one.

Want to confirm for MySQL support.
Thank you!

Hi @yhu
For the internal metadata database, you can use H2 (default), MySQL/MariaDB or Postgres.
If you want to use MySQL instead of Postgres, then you can still use the same example, but just change MB_DB_TYPE=mysql and MB_DB_PORT=3306
There’s other (non-Docker) examples here:

Just for reference, since you linked to a very old documentation, here’s a link to the latest (currently 0.32.9):

1 Like

Hi @flamber
Thank you so much for letting me know.

Hi @flamber
once Metabase connect with Mysql for backup.
How to check whether it works? From the log, I still see this error message in log:
java.lang.Exception: DB is not set up. Make sure to call set-default-db-connection! or bind db-connection.
And my docker is running and it can log in to Metabase and create users.

I’m not sure I understand.
Did you migrate your H2 to MySQL?
How are you running the Docker container? Post your run parameters (redact any sensitive info)
You can easily check if you’re using your MySQL database - either by looking at the connections on MySQL, or by running a query and checking the metadata table query_execution for activity.

we are trying to log in to the database to check the query_exection table.
We do not migrate H2 to mySQL, we reinstall it using mySQL
So every time I run a query, the query will be saved in the backup database in query_execution table?
Do I understand correctly.
This is the log:
Jul 25 20:58:11 INFO metabase.core :: Setting up and migrating Metabase DB. Please sit tight, this may take a minute…
Jul 25 20:58:11 INFO metabase.db :: Verifying mysql Database Connection …

java.lang.Exception: DB is not set up. Make sure to call set-default-db-connection! or bind db-connection.
at toucan.db$connection.invokeStatic(db.clj:123)
at toucan.db$connection.invoke(db.clj:116)

connect metabase to your mysql instance (container) and you will see all the own metabase entities.
It is a way to validate

1 Like


Okay, I think there’s a bit of mis-communication, which might have lead to misunderstanding.

Metabase needs to save it’s data (settings, questions, dashboards, etc.) somewhere. It’s called metadata or Application Database

By default Metabase uses H2 unless you configure it to use Postgres or MySQL.

Please post your Docker run command (redact sensitive info), so I can see if it looks correct.
And if you have configured it to use MySQL, then you need to make sure that Metabase can create the tables, so the MySQL user needs to have write permissions.

1 Like

@flamber @sys2020
Thank you, actually it works. We check the query_execution table in MySQL Application DB. It saved the records.
Thank you so much!