Version v0.41 of Metabase is no longer supported. Check out the docs for the current stable version, Metabase v0.63.
If you decide to use the default application database (H2) when you initially start using Metabase, but later decide that you’d like to switch to a more production-ready database such as Postgres or MySQL/MariaDB, you’re in the right place.
We recommend running the migration outside of Docker. You’ll need to copy the H2 file out of the Docker container before migrating. For example, if the container is called metabase, you’d run:
docker cp metabase:/metabase.db/metabase.db.mv.db ./
The above command would copy the database file to the directory you ran the command from. With your database file outside of the container, all you need to do is follow the “How to migrate” steps below.
Metabase provides a custom migration command for upgrading H2 application database files by copying their data to a new database. Here’s what you’ll do:
export MB_DB_TYPE=postgres
export MB_DB_DBNAME=metabase
export MB_DB_PORT=5432
export MB_DB_USER=<username>
export MB_DB_PASS=<password>
export MB_DB_HOST=localhost
java -jar metabase.jar load-from-h2 /path/to/metabase.db # do not include .mv.db
Note that the file name of the database file itself might be /path/to/metabase.db.mv.db, but when running the load-from-h2 command, you need to truncate the path to /path/to/metabase.db.
Metabase expects that you’ll run the command against a brand-new (empty) database; it’ll create the database schema and migrate the data for you.
utf8mb4_unicode_ci collation, utf8mb4 character set, and innodb_large_prefix=ON.If you get an error, check out this troubleshooting guide.