Migrate metabase from postgres to mariadb

I have Metabase with PostgreSQL, and I want to migrate to MariaDB. Is it possible? What steps should I follow?

metabase version v0.46.5
posgres postgres:13.2-alpine

Do you want to migrate the Metabase application database to MariaDB?

First: unless you have a very strong reason to do that, I'd keep Postgres as the Metabase AppDB. This is our preferred option.
We support MariaDB because it is compatible with MySQL, but we are seeing both databases diverging, and we haven't discussed yet if we will support MariaDB if they diverge enough.

But if you want to do this: you can run the dump-to-h2 command to create a h2 version of your appdb and then load-from-h2 to your MariaDB application database.

You'd run dump-to-h2 and then follow:

i try the dump-to-h2 command

inside my docker with metabase in /app folder i run
app# java -jar metabase.jar dump-to-h2 database.db

but i got this error

Warning: environ value jdk-11.0.19+7 for key :java-version has been overwritten with 11.0.19
2023-12-01 20:21:09,869 INFO metabase.util :: Maximum memory available to JVM: 7.7 GB
2023-12-01 20:21:11,185 INFO util.encryption :: Saved credentials encryption is DISABLED for this Metabase instance. :unlock:
For more information, see Redirecting…
..instrumented #'metabase.util.malli/with-api-error-message
..instrumented #'metabase.util.honey-sql-2/identifier
..instrumented #'metabase.util.honey-sql-2/normalize-type-info
..instrumented #'metabase.util.honey-sql-2/with-database-type-info
..instrumented #'metabase.util.honey-sql-2/cast
..instrumented #'metabase.util.honey-sql-2/quoted-cast
..instrumented #'metabase.util.honey-sql-2/maybe-cast
..instrumented #'metabase.models.permissions/classify-path
..instrumented #'metabase.models.permissions/classify-data-path
..instrumented #'metabase.models.permissions/generate-graph
..instrumented #'metabase.models.permissions/->v2-path
..instrumented #'metabase.models.permissions/update-db-data-access-permissions!
..instrumented #'metabase.models.permissions/update-group-permissions!
..instrumented #'metabase.models.permissions/update-data-perms-graph!
..instrumented #'metabase.models.parameter-card/upsert-or-delete-from-parameters!
WARNING: abs already refers to: #'clojure.core/abs in namespace: kixi.stats.math, being replaced by: #'kixi.stats.math/abs
WARNING: abs already refers to: #'clojure.core/abs in namespace: kixi.stats.test, being replaced by: #'kixi.stats.math/abs
WARNING: abs already refers to: #'clojure.core/abs in namespace: kixi.stats.distribution, being replaced by: #'kixi.stats.math/abs
..instrumented #'metabase.query-processor.middleware.permissions/check-query-permissions*
..instrumented #'metabase.driver.sql-jdbc.sync.describe-database/simple-select-probe-query
2023-12-01 20:21:15,034 INFO driver.impl :: Registered abstract driver :sql :truck:
2023-12-01 20:21:15,037 INFO metabase.util :: ⮦ Load driver :sql took 66.8 ms
2023-12-01 20:21:15,040 INFO driver.impl :: Registered abstract driver :sql-jdbc (parents: [:sql]) :truck:
2023-12-01 20:21:15,043 INFO metabase.util :: Load driver :sql-jdbc took 75.0 ms
2023-12-01 20:21:15,043 INFO driver.impl :: Registered driver :h2 (parents: [:sql-jdbc]) :truck:
..instrumented #'metabase.driver.h2/classify-query
2023-12-01 20:21:15,094 INFO driver.impl :: Registered driver :mysql (parents: [:sql-jdbc]) :truck:
2023-12-01 20:21:15,117 INFO driver.impl :: Registered driver :postgres (parents: [:sql-jdbc]) :truck:
..instrumented #'metabase.models.params.custom-values/values-from-card
..instrumented #'metabase.api.card/param-values
..instrumented #'metabase.api.dashboard/chain-filter
..instrumented #'metabase.api.setup/state-for-checklist
..instrumented #'metabase.api.setup/checklist-items
2023-12-01 20:21:16,351 INFO metabase.core ::
Metabase v0.46.5 (272e3e6 release-x.46.x)

Copyright © 2023 Metabase, Inc.

Metabase Enterprise Edition extensions are NOT PRESENT.
2023-12-01 20:21:16,388 INFO cmd.dump-to-h2 :: Dumping from configured Metabase db to H2 file database.db
2023-12-01 20:21:16,389 INFO cmd.copy :: Set up postgres source database and run migrations...
2023-12-01 20:21:16,391 INFO db.setup :: Verifying postgres Database Connection ...
2023-12-01 20:21:16,495 INFO db.setup :: Successfully verified PostgreSQL 13.2 application database connection. :white_check_mark:
2023-12-01 20:21:16,496 INFO db.setup :: Running Database Migrations...
2023-12-01 20:21:16,497 INFO db.setup :: Setting up Liquibase...
2023-12-01 20:21:16,646 INFO db.setup :: Liquibase is ready.
2023-12-01 20:21:16,647 INFO db.liquibase :: Checking if Database has unrun migrations...
2023-12-01 20:21:17,478 INFO db.setup :: Database Migrations Current ... :white_check_mark:
2023-12-01 20:21:17,479 INFO db.data-migrations :: Running all necessary data migrations, this may take a minute.
2023-12-01 20:21:17,830 INFO db.data-migrations :: Finished running data migrations.
2023-12-01 20:21:17,831 INFO metabase.util :: Database setup took 1.4 s
2023-12-01 20:21:17,831 INFO cmd.copy :: [OK]
2023-12-01 20:21:17,831 INFO cmd.copy :: Set up h2 target database and run migrations...
2023-12-01 20:21:17,832 INFO db.setup :: Verifying h2 Database Connection ...
2023-12-01 20:21:18,012 INFO db.setup :: Successfully verified H2 2.1.212 (2022-04-09) application database connection. :white_check_mark:
2023-12-01 20:21:18,018 INFO db.setup :: Running Database Migrations...
2023-12-01 20:21:18,023 INFO db.setup :: Setting up Liquibase...
2023-12-01 20:21:18,030 INFO db.setup :: Liquibase is ready.
2023-12-01 20:21:18,031 INFO db.liquibase :: Checking if Database has unrun migrations...
2023-12-01 20:21:18,629 INFO db.liquibase :: Database has unrun migrations. Waiting for migration lock to be cleared...
2023-12-01 20:21:18,685 INFO db.liquibase :: Migration lock is cleared. Running migrations...
2023-12-01 20:21:20,582 INFO impl.StdSchedulerFactory :: Using default implementation for ThreadExecutor
2023-12-01 20:21:20,592 INFO core.SchedulerSignalerImpl :: Initialized Scheduler Signaller of type: class org.quartz.core.SchedulerSignalerImpl
2023-12-01 20:21:20,592 INFO core.QuartzScheduler :: Quartz Scheduler v.2.3.2 created.
2023-12-01 20:21:20,593 INFO jdbcjobstore.JobStoreTX :: Using db table-based data access locking (synchronization).
2023-12-01 20:21:20,594 INFO jdbcjobstore.JobStoreTX :: JobStoreTX initialized.
2023-12-01 20:21:20,594 INFO core.QuartzScheduler :: Scheduler meta-data: Quartz Scheduler (v2.3.2) 'MetabaseScheduler' with instanceId '784b0074726b1701462080583'
Scheduler class: 'org.quartz.core.QuartzScheduler' - running locally.
NOT STARTED.
Currently in standby mode.
Number of jobs executed: 0
Using thread pool 'org.quartz.simpl.SimpleThreadPool' - with 10 threads.
Using job-store 'org.quartz.impl.jdbcjobstore.JobStoreTX' - which supports persistence. and is clustered.

2023-12-01 20:21:20,594 INFO impl.StdSchedulerFactory :: Quartz scheduler 'MetabaseScheduler' initialized from default resource file in Quartz package: 'quartz.properties'
2023-12-01 20:21:20,595 INFO impl.StdSchedulerFactory :: Quartz scheduler version: 2.3.2
2023-12-01 20:21:20,608 INFO core.QuartzScheduler :: Scheduler MetabaseScheduler_$784b0074726b1701462080583 started.
2023-12-01 20:21:20,618 INFO core.QuartzScheduler :: Scheduler MetabaseScheduler
$784b0074726b1701462080583 shutting down.
2023-12-01 20:21:20,618 INFO core.QuartzScheduler :: Scheduler MetabaseScheduler
$784b0074726b1701462080583 paused.
2023-12-01 20:21:20,619 INFO core.QuartzScheduler :: Scheduler MetabaseScheduler
$_784b0074726b1701462080583 shutdown complete.
2023-12-01 20:21:20,662 INFO db.setup :: Database Migrations Current ... :white_check_mark:
2023-12-01 20:21:20,662 INFO metabase.util :: Database setup took 2.8 s
2023-12-01 20:21:20,662 INFO cmd.copy :: [OK]
2023-12-01 20:21:20,663 INFO cmd.copy :: Testing if target h2 database is already populated...
2023-12-01 20:21:20,709 INFO cmd.copy :: [OK]
2023-12-01 20:21:20,709 INFO cmd.copy :: Clearing default entries created by Liquibase migrations...
2023-12-01 20:21:20,737 INFO cmd.copy :: Temporarily disabling DB constraints...
2023-12-01 20:21:20,738 INFO cmd.copy :: [OK]
2023-12-01 20:21:20,749 INFO cmd.copy :: Re-enabling DB constraints...
2023-12-01 20:21:20,749 INFO cmd.copy :: [OK]
2023-12-01 20:21:20,757 INFO cmd.copy :: [OK]
2023-12-01 20:21:20,790 INFO cmd.copy :: Temporarily disabling DB constraints...
2023-12-01 20:21:20,790 INFO cmd.copy :: [OK]
2023-12-01 20:21:20,795 INFO cmd.copy :: Copying instances of Database...
2023-12-01 20:21:20,802 INFO cmd.copy :: copied 3 instances.
2023-12-01 20:21:20,815 INFO cmd.copy :: Copying instances of User...
2023-12-01 20:21:20,826 INFO cmd.copy :: copied 87 instances.
2023-12-01 20:21:20,827 INFO cmd.copy :: Copying instances of Setting...
2023-12-01 20:21:20,831 ERROR cmd.copy :: JdbcBatchUpdateException:
Message: Unique index or primary key violation: "PUBLIC.PRIMARY_KEY_DB ON PUBLIC.SETTING(""KEY"") VALUES ( /* 1 / 'instance-creation' )"; SQL statement:
INSERT INTO setting ( "KEY", "VALUE" ) VALUES ( ?, ? ) [23505-212]
SQLState: 23505
Error Code: 23505
JdbcSQLIntegrityConstraintViolationException:
Message: Unique index or primary key violation: "PUBLIC.PRIMARY_KEY_DB ON PUBLIC.SETTING(""KEY"") VALUES ( /
1 / 'instance-creation' )"; SQL statement:
INSERT INTO setting ( "KEY", "VALUE" ) VALUES ( ?, ? ) [23505-212]
SQLState: 23505
Error Code: 23505
JdbcSQLIntegrityConstraintViolationException:
Message: Unique index or primary key violation: "PUBLIC.PRIMARY_KEY_DB ON PUBLIC.SETTING(""KEY"") VALUES ( /
2 / 'analytics-uuid' )"; SQL statement:
INSERT INTO setting ( "KEY", "VALUE" ) VALUES ( ?, ? ) [23505-212]
SQLState: 23505
Error Code: 23505
JdbcSQLIntegrityConstraintViolationException:
Message: Unique index or primary key violation: "PUBLIC.PRIMARY_KEY_DB ON PUBLIC.SETTING(""KEY"") VALUES ( /
31 */ 'settings-last-updated' )"; SQL statement:
INSERT INTO setting ( "KEY", "VALUE" ) VALUES ( ?, ? ) [23505-212]
SQLState: 23505
Error Code: 23505

2023-12-01 20:21:20,831 INFO cmd.copy :: Re-enabling DB constraints...
2023-12-01 20:21:20,832 INFO cmd.copy :: [OK]
2023-12-01 20:21:20,843 ERROR metabase.cmd :: Failed to dump application database to H2 file
clojure.lang.ExceptionInfo: Error copying instances of Setting {:entity "Setting"}
at metabase.cmd.copy$copy_data_BANG_$fn__101815$fn__101816.invoke(copy.clj:194)
at metabase.cmd.copy$copy_data_BANG_$fn__101815.invoke(copy.clj:191)
at clojure.core$partition_all$fn__8625$fn__8626.invoke(core.clj:7325)
at clojure.core$transduce.invokeStatic(core.clj:6948)
at clojure.core$transduce.invoke(core.clj:6933)
at metabase.cmd.copy$copy_data_BANG_.invokeStatic(copy.clj:179)
at metabase.cmd.copy$copy_data_BANG_.invoke(copy.clj:170)
at metabase.cmd.copy$fn__101935$copy_BANG___101940$fn__101941$fn__101950$fn__101951$fn__101952.invoke(copy.clj:382)
at metabase.cmd.copy$do_with_disabled_db_constraints.invokeStatic(copy.clj:271)
at metabase.cmd.copy$do_with_disabled_db_constraints.invoke(copy.clj:267)
at metabase.cmd.copy$fn__101935$copy_BANG___101940$fn__101941$fn__101950$fn__101951.invoke(copy.clj:381)
at metabase.cmd.copy$do_with_connection_rollback_only.invokeStatic(copy.clj:213)
at metabase.cmd.copy$do_with_connection_rollback_only.invoke(copy.clj:211)
at metabase.cmd.copy$fn__101935$copy_BANG___101940$fn__101941$fn__101950.invoke(copy.clj:379)
at clojure.java.jdbc$db_transaction_STAR_.invokeStatic(jdbc.clj:807)
at clojure.java.jdbc$db_transaction_STAR_.invoke(jdbc.clj:776)
at clojure.java.jdbc$db_transaction_STAR_.invokeStatic(jdbc.clj:852)
at clojure.java.jdbc$db_transaction_STAR_.invoke(jdbc.clj:776)
at clojure.java.jdbc$db_transaction_STAR_.invokeStatic(jdbc.clj:789)
at clojure.java.jdbc$db_transaction_STAR_.invoke(jdbc.clj:776)
at metabase.cmd.copy$fn__101935$copy_BANG___101940$fn__101941.invoke(copy.clj:376)
at metabase.cmd.copy$fn__101935$copy_BANG___101940.invoke(copy.clj:353)
at metabase.cmd.dump_to_h2$dump_to_h2_BANG_.invokeStatic(dump_to_h2.clj:39)
at metabase.cmd.dump_to_h2$dump_to_h2_BANG_.invoke(dump_to_h2.clj:22)
at clojure.lang.Var.invoke(Var.java:388)
at metabase.cmd$dump_to_h2.invokeStatic(cmd.clj:59)
at metabase.cmd$dump_to_h2.doInvoke(cmd.clj:50)
at clojure.lang.RestFn.invoke(RestFn.java:410)
at clojure.lang.AFn.applyToHelper(AFn.java:154)
at clojure.lang.RestFn.applyTo(RestFn.java:132)
at clojure.core$apply.invokeStatic(core.clj:667)
at clojure.core$apply.invoke(core.clj:662)
at metabase.cmd$run_cmd$fn__103073.invoke(cmd.clj:264)
at metabase.cmd$run_cmd.invokeStatic(cmd.clj:264)
at metabase.cmd$run_cmd.invoke(cmd.clj:255)
at clojure.lang.Var.invoke(Var.java:388)
at metabase.core$run_cmd.invokeStatic(core.clj:166)
at metabase.core$run_cmd.invoke(core.clj:164)
at metabase.core$main.invokeStatic(core.clj:188)
at metabase.core$main.doInvoke(core.clj:183)
at clojure.lang.RestFn.applyTo(RestFn.java:137)
at clojure.lang.Var.applyTo(Var.java:705)
at clojure.core$apply.invokeStatic(core.clj:667)
at clojure.core$apply.invoke(core.clj:662)
at metabase.bootstrap$main.invokeStatic(bootstrap.clj:31)
at metabase.bootstrap$main.doInvoke(bootstrap.clj:28)
at clojure.lang.RestFn.applyTo(RestFn.java:137)
at metabase.bootstrap.main(Unknown Source)
Caused by: org.h2.jdbc.JdbcBatchUpdateException: Unique index or primary key violation: "PUBLIC.PRIMARY_KEY_DB ON PUBLIC.SETTING(""KEY"") VALUES ( /* 1 */ 'instance-creation' )"; SQL statement:
INSERT INTO setting ( "KEY", "VALUE" ) VALUES ( ?, ? ) [23505-212]
at org.h2.jdbc.JdbcPreparedStatement.executeBatch(JdbcPreparedStatement.java:1269)
at clojure.java.jdbc$execute_batch.invokeStatic(jdbc.clj:598)
at clojure.java.jdbc$execute_batch.invoke(jdbc.clj:591)
at clojure.java.jdbc$db_do_execute_prepared_statement.invokeStatic(jdbc.clj:1058)
at clojure.java.jdbc$db_do_execute_prepared_statement.invoke(jdbc.clj:1042)
at clojure.java.jdbc$db_do_prepared.invokeStatic(jdbc.clj:1080)
at clojure.java.jdbc$db_do_prepared.invoke(jdbc.clj:1060)
at clojure.java.jdbc$insert_cols_BANG
.invokeStatic(jdbc.clj:1594)
at clojure.java.jdbc$insert_cols_BANG
.invoke(jdbc.clj:1585)
at clojure.java.jdbc$insert_multi_BANG
.invokeStatic(jdbc.clj:1653)
at clojure.java.jdbc$insert_multi_BANG
.invoke(jdbc.clj:1619)
at metabase.cmd.copy$insert_chunk_BANG_.invokeStatic(copy.clj:161)
at metabase.cmd.copy$insert_chunk_BANG_.invoke(copy.clj:155)
at metabase.cmd.copy$copy_data_BANG_$fn__101815$fn__101816.invoke(copy.clj:192)
... 47 more

Hello! I'm experiencing a similar issue. did you manage to solve it? thanks in advance

please move to 47.10 at least and try again

please move to 47.10 and try again