Metabase Docker Compose with mysql

I keep getting this error whenever I run docker-compose up:

metabase-app_1 | java.sql.SQLException: Could not connect to address=(host=mysql-db)(port=3306)(type=master) : RSA public key is not available client side (option serverRsaPublicKeyFile not set)
metabase-app_1 | at org.mariadb.jdbc.internal.util.exceptions.ExceptionMapper.get(ExceptionMapper.java:262)
metabase-app_1 | at org.mariadb.jdbc.internal.protocol.AbstractConnectProtocol.connectWithoutProxy(AbstractConnectProtocol.java:1241)
metabase-app_1 | at org.mariadb.jdbc.internal.util.Utils.retrieveProxy(Utils.java:610)
metabase-app_1 | at org.mariadb.jdbc.MariaDbConnection.newConnection(MariaDbConnection.java:142)
metabase-app_1 | at org.mariadb.jdbc.Driver.connect(Driver.java:86)
metabase-app_1 | at java.sql/java.sql.DriverManager.getConnection(Unknown Source)
metabase-app_1 | at java.sql/java.sql.DriverManager.getConnection(Unknown Source)
metabase-app_1 | at clojure.java.jdbc$get_driver_connection.invokeStatic(jdbc.clj:271)
metabase-app_1 | at clojure.java.jdbc$get_driver_connection.invoke(jdbc.clj:250)
metabase-app_1 | at clojure.java.jdbc$get_connection.invokeStatic(jdbc.clj:411)
metabase-app_1 | at clojure.java.jdbc$get_connection.invoke(jdbc.clj:274)
metabase-app_1 | at clojure.java.jdbc$db_query_with_resultset_STAR_.invokeStatic(jdbc.clj:1093)
metabase-app_1 | at clojure.java.jdbc$db_query_with_resultset_STAR_.invoke(jdbc.clj:1075)
metabase-app_1 | at clojure.java.jdbc$query.invokeStatic(jdbc.clj:1164)
metabase-app_1 | at clojure.java.jdbc$query.invoke(jdbc.clj:1126)
metabase-app_1 | at clojure.java.jdbc$query.invokeStatic(jdbc.clj:1142)
metabase-app_1 | at clojure.java.jdbc$query.invoke(jdbc.clj:1126)
metabase-app_1 | at metabase.driver.sql_jdbc.connection$can_connect_QMARK_.invokeStatic(connection.clj:161)
metabase-app_1 | at metabase.driver.sql_jdbc.connection$can_connect_QMARK_.invoke(connection.clj:156)
metabase-app_1 | at metabase.driver.sql_jdbc$fn__72705.invokeStatic(sql_jdbc.clj:37)
metabase-app_1 | at metabase.driver.sql_jdbc$fn__72705.invoke(sql_jdbc.clj:35)
metabase-app_1 | at metabase.driver.mysql$fn__71859.invokeStatic(mysql.clj:76)
metabase-app_1 | at metabase.driver.mysql$fn__71859.invoke(mysql.clj:72)
metabase-app_1 | at clojure.lang.MultiFn.invoke(MultiFn.java:234)
metabase-app_1 | at metabase.driver.util$can_connect_with_details_QMARK_$fn__22354.invoke(util.clj:30)
metabase-app_1 | at metabase.util$do_with_timeout$fn__9176.invoke(util.clj:310)
metabase-app_1 | at clojure.core$binding_conveyor_fn$fn__5754.invoke(core.clj:2030)
metabase-app_1 | at clojure.lang.AFn.call(AFn.java:18)
metabase-app_1 | at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
metabase-app_1 | at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
metabase-app_1 | at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
metabase-app_1 | at java.base/java.lang.Thread.run(Unknown Source)
metabase-app_1 | Caused by: java.sql.SQLException: RSA public key is not available client side (option serverRsaPublicKeyFile not set)
metabase-app_1 | at org.mariadb.jdbc.internal.com.send.authentication.CachingSha2PasswordPlugin.process(CachingSha2PasswordPlugin.java:187)
metabase-app_1 | at org.mariadb.jdbc.internal.protocol.AbstractConnectProtocol.authenticationHandler(AbstractConnectProtocol.java:703)
metabase-app_1 | at org.mariadb.jdbc.internal.protocol.AbstractConnectProtocol.createConnection(AbstractConnectProtocol.java:507)
metabase-app_1 | at org.mariadb.jdbc.internal.protocol.AbstractConnectProtocol.connectWithoutProxy(AbstractConnectProtocol.java:1236)
metabase-app_1 | … 30 more

The following is my docker-compose file:

version: “3”
services:

mysql-db:
image: mysql:latest
volumes:
- “./mysql_data:/var/lib/mysql”
restart: always
ports:
- “3307:3306”
environment:
MYSQL_ROOT_PASSWORD: dbmetabaserootpassword
MYSQL_DATABASE: metabase
MYSQL_USER: metabase
MYSQL_PASSWORD: metabasedatabasepassword

phpmyadmin:
image: phpmyadmin/phpmyadmin:latest
container_name: metabase_pma
links:
- mysql-db
environment:
PMA_HOST: mysql-db
PMA_PORT: 3306
PMA_ARBITRARY: 1
restart: always
ports:
- 8185:80

metabase-app:
image: metabase/metabase
restart: always
ports:
- 3001:3000
volumes:
# declare your mount volume /host/dir:/container/dir
- ./metabase-data:/metabase-data
environment:
MB_DB_TYPE: mysql
MB_DB_DBNAME: metabase
MB_DB_PORT: 3306
MB_DB_USER: metabase
MB_DB_PASS: “metabasedatabasepassword”
MB_DB_HOST: mysql-db
depends_on:
- mysql-db
links:
- mysql-db

I am able to access the MySQL database from PHPMyAdmin.

Thank you.

Hi @partoa
Which version of MySQL and Metabase?
The error is RSA public key is not available client side, so it might have something to do with the connector version (2.5.1) used in Metabase (0.35.3), which is fixed in later connector versions: https://jira.mariadb.org/browse/CONJ-742

Makes sense. Does this mean that I would to compile metabase with a newer connector version?

Just did that. Still having the same error. I’ll just switch to PostgreSQL for now.

For reference:
https://github.com/metabase/metabase/issues/12545