Changing location of db files

Hello, I want to move the location of the db files (i.e., metabase.db.trace.db) to a different location other than the Metabase install location.

My install location is simply: C:\Program Files\Metabase yet I would like to have the db files in a different location. For arguments sake, let's say: D:\Metabase_DatabaseFiles

I was following along the help document:

which implies that I use a command prompt to set the new location on a windows machine (windows 10):

set MB_DB_TYPE=h2
set MB_DB_FILE=/the/path/to/my/h2.db

and then fire up metabase:

java -jar metabase.jar

That all seems to have worked but when I restart my computer, it seems like Metabase loses the connection to the db files in the different location and, instead, creates new db files in the install location and when I start Metabase, I am prompted to create a new account. I am assuming that, when I restart my computer, Metabase forgets that I set the db files to a new location and creates new ones? I am not too sure?

For reference:

  • I am running the Metabase jar file v0.40.1
  • I have Metabase starting as a service. The service was created using the nssm install utility
  • I do not have access to Postgres, MySQL or MariaDB. Only Oracle, but from what I understand, you cannot migrate to Oracle at this time with Metabase.

Any suggestions on what I may be doing wrong is welcome.

Hi @rossi45
It's not recommended to use H2 in production. You should migrate to Postgres or MariaDB/MySQL:

Environment variables (set ... on Windows) are not preserved across reboot, so you need to set them again. For Windows, it's recommended to use a Batch file (.bat) where you include all 3 lines, so you know it's defined every time.