Unable to migrate from H2 to mysql using windows (command prompt)

Hi ,
I am trying to migrate from H2 to mysql after installation of metabase .I was able to connect to both DBs (default and Mysql). I am using commandline prompt to set the env variables ,ending up with error kindly help metabase is not loading also the metabse.db.mv file is still present

Below are my specifications

Metabase - [v0.36.6 (Latest)]
mysql -8.0.21
OS-Windows 10
Cmd line to run the commands and jar file

I ran the below commands
SET MB_DB_TYPE=mysql
SET MB_DB_DBNAME=metabase
SET MB_DB_PORT=3306
SET MB_DB_USER=root
SET MB_DB_PASS=Welcome#123
SET MB_DB_HOST=localhost
java -jar C:\Metabase\metabase.jar

Logs are as below

C:\Metabase>java -jar C:\Metabase\metabase.jar
09-28 20:52:06 e[1mINFO metabase.utile[0m :: Loading Metabase…
09-28 20:52:06 e[1mINFO metabase.utile[0m :: Maximum memory available to JVM: 862.5 MB
WARNING: not-empty already refers to: #'clojure.core/not-empty in namespace: metabase.mbql.schema, being replaced by: #'metabase.mbql.schema/not-empty
09-28 20:52:17 e[1mINFO util.encryptione[0m :: Saved credentials encryption is DISABLED for this Metabase instance.
For more information, see https://metabase.com/docs/latest/operations-guide/encrypting-database-details-at-rest.html
09-28 20:52:24 e[1mWARN metabase.coree[0m :: WARNING: You have enabled namespace tracing, which could log sensitive information like db passwords.
09-28 20:52:24 e[1mINFO metabase.coree[0m :: Starting Metabase in STANDALONE mode
09-28 20:52:24 e[1mINFO metabase.servere[0m :: Launching Embedded Jetty Webserver with config:
{:port 3000}

09-28 20:52:24 e[1mINFO metabase.coree[0m :: Starting Metabase version v0.36.6 (cb258fb release-0.36.x) …
09-28 20:52:24 e[1mINFO metabase.coree[0m :: System info:
{“file.encoding” “Cp1252”,
“java.runtime.name” “Java™ SE Runtime Environment”,
“java.runtime.version” “1.8.0_261-b12”,
“java.vendor” “Oracle Corporation”,
“java.vendor.url” “http://java.oracle.com/”,
“java.version” “1.8.0_261”,
“java.vm.name” “Java HotSpot™ 64-Bit Server VM”,
“java.vm.version” “25.261-b12”,
“os.name” “Windows 10”,
“os.version” “10.0”,
“user.language” “en”,
“user.timezone” “Asia/Calcutta”}

09-28 20:52:24 e[1mINFO metabase.pluginse[0m :: Loading plugins in C:\Metabase\plugins…
09-28 20:52:25 e[1mINFO plugins.dependenciese[0m :: Plugin ‘Metabase BigQuery Driver’ depends on plugin ‘Metabase Google Drivers Shared Dependencies’
09-28 20:52:25 e[1mINFO plugins.dependenciese[0m :: Metabase BigQuery Driver dependency {:plugin Metabase Google Drivers Shared Dependencies} satisfied? false
09-28 20:52:25 e[1mINFO plugins.dependenciese[0m :: Plugins with unsatisfied deps: [“Metabase BigQuery Driver”]
09-28 20:52:25 e[1mDEBUG plugins.lazy-loaded-drivere[0m :: Registering lazy loading driver :druid…
09-28 20:52:25 e[1mINFO driver.imple[0m :: Registered driver :druid
09-28 20:52:25 e[1mDEBUG plugins.lazy-loaded-drivere[0m :: Registering lazy loading driver :google…
09-28 20:52:25 e[1mINFO driver.imple[0m :: Registered abstract driver :google
09-28 20:52:25 e[1mINFO plugins.dependenciese[0m :: Metabase BigQuery Driver dependency {:plugin Metabase Google Drivers Shared Dependencies} satisfied? true
09-28 20:52:25 e[1mDEBUG plugins.initializee[0m :: Dependencies satisfied; these plugins will now be loaded: [“Metabase BigQuery Driver”]
09-28 20:52:25 e[1mWARN plugins.lazy-loaded-drivere[0m :: Warning: plugin manifest for :bigquery does not include connection properties
09-28 20:52:25 e[1mDEBUG plugins.lazy-loaded-drivere[0m :: Registering lazy loading driver :bigquery…
09-28 20:52:25 e[1mINFO driver.imple[0m :: Registered abstract driver :sql
Load driver :sql took 337.5 ms
09-28 20:52:25 e[1mINFO driver.imple[0m :: Registered driver :bigquery (parents: [:sql :google])
09-28 20:52:25 e[1mINFO plugins.dependenciese[0m :: Plugin ‘Metabase Google Analytics Driver’ depends on plugin ‘Metabase Google Drivers Shared Dependencies’
09-28 20:52:25 e[1mINFO plugins.dependenciese[0m :: Metabase Google Analytics Driver dependency {:plugin Metabase Google Drivers Shared Dependencies} satisfied? true
09-28 20:52:25 e[1mDEBUG plugins.lazy-loaded-drivere[0m :: Registering lazy loading driver :googleanalytics…
09-28 20:52:25 e[1mINFO driver.imple[0m :: Registered driver :googleanalytics (parents: [:google])
09-28 20:52:26 e[1mDEBUG plugins.lazy-loaded-drivere[0m :: Registering lazy loading driver :mongo…
09-28 20:52:26 e[1mINFO driver.imple[0m :: Registered driver :mongo
09-28 20:52:26 e[1mINFO plugins.dependenciese[0m :: Metabase cannot initialize plugin Metabase Oracle Driver due to required dependencies. Metabase requires the Oracle JDBC driver in order to connect to Oracle databases, but we can’t ship it as part of Metabase due to licensing restrictions. See https://metabase.com/docs/latest/administration-guide/databases/oracle.html for more details.

09-28 20:52:26 e[1mINFO plugins.dependenciese[0m :: Metabase Oracle Driver dependency {:class oracle.jdbc.OracleDriver} satisfied? false
09-28 20:52:26 e[1mINFO plugins.dependenciese[0m :: Plugins with unsatisfied deps: [“Metabase Oracle Driver”]
09-28 20:52:26 e[1mDEBUG plugins.lazy-loaded-drivere[0m :: Registering lazy loading driver :presto…
09-28 20:52:26 e[1mINFO driver.imple[0m :: Registered driver :presto (parents: [:sql])
09-28 20:52:26 e[1mDEBUG plugins.lazy-loaded-drivere[0m :: Registering lazy loading driver :redshift…
09-28 20:52:26 e[1mINFO driver.imple[0m :: Registered abstract driver :sql-jdbc (parents: [:sql])
Load driver :sql-jdbc took 21.4 ms
09-28 20:52:26 e[1mINFO driver.imple[0m :: Registered driver :postgres (parents: [:sql-jdbc])
Load driver :postgres took 161.6 ms
09-28 20:52:26 e[1mINFO driver.imple[0m :: Registered driver :redshift (parents: [:postgres])
09-28 20:52:26 e[1mDEBUG plugins.lazy-loaded-drivere[0m :: Registering lazy loading driver :snowflake…
09-28 20:52:26 e[1mINFO driver.imple[0m :: Registered driver :snowflake (parents: [:sql-jdbc])
09-28 20:52:26 e[1mDEBUG plugins.lazy-loaded-drivere[0m :: Registering lazy loading driver :hive-like…
09-28 20:52:26 e[1mINFO driver.imple[0m :: Registered abstract driver :hive-like (parents: [:sql-jdbc])
09-28 20:52:26 e[1mDEBUG plugins.lazy-loaded-drivere[0m :: Registering lazy loading driver :sparksql…
09-28 20:52:26 e[1mINFO driver.imple[0m :: Registered driver :sparksql (parents: [:hive-like])
09-28 20:52:26 e[1mDEBUG plugins.lazy-loaded-drivere[0m :: Registering lazy loading driver :sqlite…
09-28 20:52:26 e[1mINFO driver.imple[0m :: Registered driver :sqlite (parents: [:sql-jdbc])
09-28 20:52:26 e[1mDEBUG plugins.lazy-loaded-drivere[0m :: Registering lazy loading driver :sqlserver…
09-28 20:52:26 e[1mINFO driver.imple[0m :: Registered driver :sqlserver (parents: [:sql-jdbc])
09-28 20:52:26 e[1mINFO plugins.dependenciese[0m :: Metabase cannot initialize plugin Metabase Vertica Driver due to required dependencies. Metabase requires the Vertica JDBC driver in order to connect to Vertica databases, but we can’t ship it as part of Metabase due to licensing restrictions. See https://metabase.com/docs/latest/administration-guide/databases/vertica.html for more details.

09-28 20:52:26 e[1mINFO plugins.dependenciese[0m :: Metabase Vertica Driver dependency {:class com.vertica.jdbc.Driver} satisfied? false
09-28 20:52:26 e[1mINFO plugins.dependenciese[0m :: Plugins with unsatisfied deps: [“Metabase Vertica Driver” “Metabase Oracle Driver”]
09-28 20:52:26 e[1mINFO driver.imple[0m :: Registered driver :h2 (parents: [:sql-jdbc])
09-28 20:52:26 e[1mINFO driver.imple[0m :: Registered driver :mysql (parents: [:sql-jdbc])
09-28 20:52:26 e[1mINFO metabase.coree[0m :: Setting up and migrating Metabase DB. Please sit tight, this may take a minute…
09-28 20:52:26 e[1mINFO metabase.dbe[0m :: Verifying mysql Database Connection …
09-28 20:52:26 e[1mINFO driver.imple[0m :: Initializing driver :sql…
09-28 20:52:26 e[1mINFO driver.imple[0m :: Initializing driver :sql-jdbc…
09-28 20:52:26 e[1mINFO driver.imple[0m :: Initializing driver :mysql…
09-28 20:52:26 e[1mERROR driver.utile[0m :: Database connection error
java.sql.SQLSyntaxErrorException: Could not connect to address=(host=localhost)(port=3306)(type=master) : (conn=1927) Unknown database ‘metabase’
at org.mariadb.jdbc.internal.util.exceptions.ExceptionFactory.createException(ExceptionFactory.java:62)
at org.mariadb.jdbc.internal.util.exceptions.ExceptionFactory.create(ExceptionFactory.java:192)
at org.mariadb.jdbc.internal.protocol.AbstractConnectProtocol.connectWithoutProxy(AbstractConnectProtocol.java:1372)
at org.mariadb.jdbc.internal.util.Utils.retrieveProxy(Utils.java:635)
at org.mariadb.jdbc.MariaDbConnection.newConnection(MariaDbConnection.java:150)
at org.mariadb.jdbc.Driver.connect(Driver.java:89)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at clojure.java.jdbc$get_driver_connection.invokeStatic(jdbc.clj:271)
at clojure.java.jdbc$get_driver_connection.invoke(jdbc.clj:250)
at clojure.java.jdbc$get_connection.invokeStatic(jdbc.clj:411)
at clojure.java.jdbc$get_connection.invoke(jdbc.clj:274)
at clojure.java.jdbc$db_query_with_resultset_STAR_.invokeStatic(jdbc.clj:1111)
at clojure.java.jdbc$db_query_with_resultset_STAR_.invoke(jdbc.clj:1093)
at clojure.java.jdbc$query.invokeStatic(jdbc.clj:1182)
at clojure.java.jdbc$query.invoke(jdbc.clj:1144)
at clojure.java.jdbc$query.invokeStatic(jdbc.clj:1160)
at clojure.java.jdbc$query.invoke(jdbc.clj:1144)
at metabase.driver.sql_jdbc.connection$can_connect_QMARK_.invokeStatic(connection.clj:159)
at metabase.driver.sql_jdbc.connection$can_connect_QMARK_.invoke(connection.clj:154)
at metabase.driver.sql_jdbc$fn__73927.invokeStatic(sql_jdbc.clj:36)
at metabase.driver.sql_jdbc$fn__73927.invoke(sql_jdbc.clj:34)
at metabase.driver.mysql$fn__73058.invokeStatic(mysql.clj:76)
at metabase.driver.mysql$fn__73058.invoke(mysql.clj:72)
at clojure.lang.MultiFn.invoke(MultiFn.java:234)
at metabase.driver.util$can_connect_with_details_QMARK_$fn__22512.invoke(util.clj:35)
at metabase.util$do_with_timeout$fn__10225.invoke(util.clj:310)
at clojure.core$binding_conveyor_fn$fn__5754.invoke(core.clj:2030)
at clojure.lang.AFn.call(AFn.java:18)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.sql.SQLSyntaxErrorException: (conn=1927) Unknown database ‘metabase’
at org.mariadb.jdbc.internal.util.exceptions.ExceptionFactory.createException(ExceptionFactory.java:62)
at org.mariadb.jdbc.internal.util.exceptions.ExceptionFactory.create(ExceptionFactory.java:187)
at org.mariadb.jdbc.internal.protocol.AbstractConnectProtocol.authenticationHandler(AbstractConnectProtocol.java:769)
at org.mariadb.jdbc.internal.protocol.AbstractConnectProtocol.createConnection(AbstractConnectProtocol.java:546)
at org.mariadb.jdbc.internal.protocol.AbstractConnectProtocol.connectWithoutProxy(AbstractConnectProtocol.java:1367)
… 30 more
09-28 20:52:26 e[1mERROR metabase.coree[0m :: Metabase Initialization FAILED
java.lang.Exception: Could not connect to address=(host=localhost)(port=3306)(type=master) : (conn=1927) Unknown database ‘metabase’
at metabase.driver.util$can_connect_with_details_QMARK_.invokeStatic(util.clj:40)
at metabase.driver.util$can_connect_with_details_QMARK_.doInvoke(util.clj:23)
at clojure.lang.RestFn.invoke(RestFn.java:442)
at clojure.lang.Var.invoke(Var.java:393)
at metabase.db$fn__21781$verify_db_connection__21790$fn__21793$fn__21794.invoke(db.clj:309)
at metabase.db$fn__21781$verify_db_connection__21790$fn__21793.invoke(db.clj:308)
at metabase.db$fn__21781$verify_db_connection__21790.invoke(db.clj:300)
at metabase.db$fn__21781$verify_db_connection__21790$fn__21791.invoke(db.clj:303)
at metabase.db$fn__21781$verify_db_connection__21790.invoke(db.clj:300)
at metabase.db$setup_db_BANG__STAR_$fn__21829.invoke(db.clj:345)
at metabase.util$do_with_us_locale.invokeStatic(util.clj:656)
at metabase.util$do_with_us_locale.invoke(util.clj:642)
at metabase.db$setup_db_BANG__STAR_.invokeStatic(db.clj:344)
at metabase.db$setup_db_BANG__STAR_.invoke(db.clj:339)
at metabase.db$setup_db_from_env_BANG_.invokeStatic(db.clj:358)
at metabase.db$setup_db_from_env_BANG_.invoke(db.clj:351)
at metabase.db$setup_db_BANG_$fn__21834.invoke(db.clj:368)
at metabase.db$setup_db_BANG_.invokeStatic(db.clj:366)
at metabase.db$setup_db_BANG_.invoke(db.clj:361)
at metabase.core$init_BANG_.invokeStatic(core.clj:75)
at metabase.core$init_BANG_.invoke(core.clj:54)
at metabase.core$start_normally.invokeStatic(core.clj:119)
at metabase.core$start_normally.invoke(core.clj:113)
at metabase.core$main.invokeStatic(core.clj:152)
at metabase.core$main.doInvoke(core.clj:146)
at clojure.lang.RestFn.invoke(RestFn.java:397)
at clojure.lang.AFn.applyToHelper(AFn.java:152)
at clojure.lang.RestFn.applyTo(RestFn.java:132)
at metabase.core.main(Unknown Source)
Caused by: java.sql.SQLSyntaxErrorException: Could not connect to address=(host=localhost)(port=3306)(type=master) : (conn=1927) Unknown database ‘metabase’
at org.mariadb.jdbc.internal.util.exceptions.ExceptionFactory.createException(ExceptionFactory.java:62)
at org.mariadb.jdbc.internal.util.exceptions.ExceptionFactory.create(ExceptionFactory.java:192)
at org.mariadb.jdbc.internal.protocol.AbstractConnectProtocol.connectWithoutProxy(AbstractConnectProtocol.java:1372)
at org.mariadb.jdbc.internal.util.Utils.retrieveProxy(Utils.java:635)
at org.mariadb.jdbc.MariaDbConnection.newConnection(MariaDbConnection.java:150)
at org.mariadb.jdbc.Driver.connect(Driver.java:89)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at clojure.java.jdbc$get_driver_connection.invokeStatic(jdbc.clj:271)
at clojure.java.jdbc$get_driver_connection.invoke(jdbc.clj:250)
at clojure.java.jdbc$get_connection.invokeStatic(jdbc.clj:411)
at clojure.java.jdbc$get_connection.invoke(jdbc.clj:274)
at clojure.java.jdbc$db_query_with_resultset_STAR
.invokeStatic(jdbc.clj:1111)
at clojure.java.jdbc$db_query_with_resultset_STAR
.invoke(jdbc.clj:1093)
at clojure.java.jdbc$query.invokeStatic(jdbc.clj:1182)
at clojure.java.jdbc$query.invoke(jdbc.clj:1144)
at clojure.java.jdbc$query.invokeStatic(jdbc.clj:1160)
at clojure.java.jdbc$query.invoke(jdbc.clj:1144)
at metabase.driver.sql_jdbc.connection$can_connect_QMARK_.invokeStatic(connection.clj:159)
at metabase.driver.sql_jdbc.connection$can_connect_QMARK_.invoke(connection.clj:154)
at metabase.driver.sql_jdbc$fn__73927.invokeStatic(sql_jdbc.clj:36)
at metabase.driver.sql_jdbc$fn__73927.invoke(sql_jdbc.clj:34)
at metabase.driver.mysql$fn__73058.invokeStatic(mysql.clj:76)
at metabase.driver.mysql$fn__73058.invoke(mysql.clj:72)
at clojure.lang.MultiFn.invoke(MultiFn.java:234)
at metabase.driver.util$can_connect_with_details_QMARK_$fn__22512.invoke(util.clj:35)
at metabase.util$do_with_timeout$fn__10225.invoke(util.clj:310)
at clojure.core$binding_conveyor_fn$fn__5754.invoke(core.clj:2030)
at clojure.lang.AFn.call(AFn.java:18)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.sql.SQLSyntaxErrorException: (conn=1927) Unknown database ‘metabase’
at org.mariadb.jdbc.internal.util.exceptions.ExceptionFactory.createException(ExceptionFactory.java:62)
at org.mariadb.jdbc.internal.util.exceptions.ExceptionFactory.create(ExceptionFactory.java:187)
at org.mariadb.jdbc.internal.protocol.AbstractConnectProtocol.authenticationHandler(AbstractConnectProtocol.java:769)
at org.mariadb.jdbc.internal.protocol.AbstractConnectProtocol.createConnection(AbstractConnectProtocol.java:546)
at org.mariadb.jdbc.internal.protocol.AbstractConnectProtocol.connectWithoutProxy(AbstractConnectProtocol.java:1367)
… 30 more
09-28 20:52:26 e[1mINFO metabase.coree[0m :: Metabase Shutting Down …
09-28 20:52:26 e[1mINFO metabase.servere[0m :: Shutting Down Embedded Jetty Webserver
09-28 20:52:26 e[1mINFO metabase.coree[0m :: Metabase Shutdown COMPLETE

Hi @devna.muralee

  1. You need to create the database on MySQL - it given this error:
    java.sql.SQLSyntaxErrorException: Could not connect to address=(host=localhost)(port=3306)(type=master) : (conn=1927) Unknown database ‘metabase’
  2. If you’re migrating from H2, then you need to tell it that (expecting H2 is in the same directory):
    java -jar C:\Metabase\metabase.jar load-from-h2 metabase.db

@flamber Thank you for the quick help

I tried again with below commands but unable to migrate

SET MB_DB_TYPE=mysql
SET MB_DB_DBNAME=metabase
SET MB_DB_PORT=3306
SET MB_DB_USER=root
SET MB_DB_PASS=Welcome#123
SET MB_DB_HOST=localhost
java -jar C:\Metabase\metabase.jar load-from-h2 metabase.db

I am still getting a connection error could you please elaborate on the 1st point?
You need to create the database on MySQL - it given this error:
java.sql.SQLSyntaxErrorException: Could not connect to address=(host=localhost)(port=3306)(type=master) : (conn=1927) Unknown database

How do I create database on Mysql for metabase

C:\Metabase>SET MB_DB_TYPE=mysql

C:\Metabase>SET MB_DB_DBNAME=metabase

C:\Metabase>SET MB_DB_PORT=3306

C:\Metabase>SET MB_DB_USER=root

C:\Metabase>SET MB_DB_PASS=Welcome#123

C:\Metabase>SET MB_DB_HOST=localhost

C:\Metabase>java -jar C:\Metabase\metabase.jar load-from-h2 metabase.db
09-28 22:36:38 e[1mINFO metabase.utile[0m :: Loading Metabase...
09-28 22:36:38 e[1mINFO metabase.utile[0m :: Maximum memory available to JVM: 862.5 MB
WARNING: not-empty already refers to: #'clojure.core/not-empty in namespace: metabase.mbql.schema, being replaced by: #'metabase.mbql.schema/not-empty
09-28 22:36:55 e[1mINFO util.encryptione[0m :: Saved credentials encryption is DISABLED for this Metabase instance.
For more information, see Redirecting…
09-28 22:37:07 e[1mWARN metabase.coree[0m :: WARNING: You have enabled namespace tracing, which could log sensitive information like db passwords.
09-28 22:37:07 e[1mINFO metabase.dbe[0m :: Verifying mysql Database Connection ...
09-28 22:37:08 e[1mINFO driver.imple[0m :: Registered abstract driver :sql
Load driver :sql took 186.0 ms
09-28 22:37:08 e[1mINFO driver.imple[0m :: Registered abstract driver :sql-jdbc (parents: [:sql])
Load driver :sql-jdbc took 212.4 ms
09-28 22:37:08 e[1mINFO driver.imple[0m :: Registered driver :mysql (parents: [:sql-jdbc])
Load driver :mysql took 345.1 ms
09-28 22:37:08 e[1mINFO driver.imple[0m :: Initializing driver :sql...
09-28 22:37:08 e[1mINFO driver.imple[0m :: Initializing driver :sql-jdbc...
09-28 22:37:08 e[1mINFO driver.imple[0m :: Initializing driver :mysql...
09-28 22:37:08 e[1mERROR driver.utile[0m :: Database connection error
java.sql.SQLSyntaxErrorException: Could not connect to address=(host=localhost)(port=3306)(type=master) : (conn=1939) Unknown database 'metabase'
at org.mariadb.jdbc.internal.util.exceptions.ExceptionFactory.createException(ExceptionFactory.java:62)
at org.mariadb.jdbc.internal.util.exceptions.ExceptionFactory.create(ExceptionFactory.java:192)
at org.mariadb.jdbc.internal.protocol.AbstractConnectProtocol.connectWithoutProxy(AbstractConnectProtocol.java:1372)
at org.mariadb.jdbc.internal.util.Utils.retrieveProxy(Utils.java:635)
at org.mariadb.jdbc.MariaDbConnection.newConnection(MariaDbConnection.java:150)
at org.mariadb.jdbc.Driver.connect(Driver.java:89)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at clojure.java.jdbc$get_driver_connection.invokeStatic(jdbc.clj:271)
at clojure.java.jdbc$get_driver_connection.invoke(jdbc.clj:250)
at clojure.java.jdbc$get_connection.invokeStatic(jdbc.clj:411)
at clojure.java.jdbc$get_connection.invoke(jdbc.clj:274)
at clojure.java.jdbc$db_query_with_resultset_STAR_.invokeStatic(jdbc.clj:1111)
at clojure.java.jdbc$db_query_with_resultset_STAR_.invoke(jdbc.clj:1093)
at clojure.java.jdbc$query.invokeStatic(jdbc.clj:1182)
at clojure.java.jdbc$query.invoke(jdbc.clj:1144)
at clojure.java.jdbc$query.invokeStatic(jdbc.clj:1160)
at clojure.java.jdbc$query.invoke(jdbc.clj:1144)
at metabase.driver.sql_jdbc.connection$can_connect_QMARK_.invokeStatic(connection.clj:159)
at metabase.driver.sql_jdbc.connection$can_connect_QMARK_.invoke(connection.clj:154)
at metabase.driver.sql_jdbc$fn__73927.invokeStatic(sql_jdbc.clj:36)
at metabase.driver.sql_jdbc$fn__73927.invoke(sql_jdbc.clj:34)
at metabase.driver.mysql$fn__73058.invokeStatic(mysql.clj:76)
at metabase.driver.mysql$fn__73058.invoke(mysql.clj:72)
at clojure.lang.MultiFn.invoke(MultiFn.java:234)
at metabase.driver.util$can_connect_with_details_QMARK_$fn__22512.invoke(util.clj:35)
at metabase.util$do_with_timeout$fn__10225.invoke(util.clj:310)
at clojure.core$binding_conveyor_fn$fn__5754.invoke(core.clj:2030)
at clojure.lang.AFn.call(AFn.java:18)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.sql.SQLSyntaxErrorException: (conn=1939) Unknown database 'metabase'
at org.mariadb.jdbc.internal.util.exceptions.ExceptionFactory.createException(ExceptionFactory.java:62)
at org.mariadb.jdbc.internal.util.exceptions.ExceptionFactory.create(ExceptionFactory.java:187)
at org.mariadb.jdbc.internal.protocol.AbstractConnectProtocol.authenticationHandler(AbstractConnectProtocol.java:769)
at org.mariadb.jdbc.internal.protocol.AbstractConnectProtocol.createConnection(AbstractConnectProtocol.java:546)
at org.mariadb.jdbc.internal.protocol.AbstractConnectProtocol.connectWithoutProxy(AbstractConnectProtocol.java:1367)
... 30 more
java.lang.Exception: Could not connect to address=(host=localhost)(port=3306)(type=master) : (conn=1939) Unknown database 'metabase'
at metabase.driver.util$can_connect_with_details_QMARK_.invokeStatic(util.clj:40)
at metabase.driver.util$can_connect_with_details_QMARK_.doInvoke(util.clj:23)
at clojure.lang.RestFn.invoke(RestFn.java:442)
at clojure.lang.Var.invoke(Var.java:393)
at metabase.db$fn__21781$verify_db_connection__21790$fn__21793$fn__21794.invoke(db.clj:309)
at metabase.db$fn__21781$verify_db_connection__21790$fn__21793.invoke(db.clj:308)
at metabase.db$fn__21781$verify_db_connection__21790.invoke(db.clj:300)
at metabase.db$fn__21781$verify_db_connection__21790$fn__21791.invoke(db.clj:303)
at metabase.db$fn__21781$verify_db_connection__21790.invoke(db.clj:300)
at metabase.db$setup_db_BANG__STAR_$fn__21829.invoke(db.clj:345)
at metabase.util$do_with_us_locale.invokeStatic(util.clj:656)
at metabase.util$do_with_us_locale.invoke(util.clj:642)
at metabase.db$setup_db_BANG__STAR_.invokeStatic(db.clj:344)
at metabase.db$setup_db_BANG__STAR_.invoke(db.clj:339)
at metabase.db$setup_db_from_env_BANG_.invokeStatic(db.clj:358)
at metabase.db$setup_db_from_env_BANG_.invoke(db.clj:351)
at metabase.db$setup_db_BANG_$fn__21834.invoke(db.clj:368)
at metabase.db$setup_db_BANG_.invokeStatic(db.clj:366)
at metabase.db$setup_db_BANG_.invoke(db.clj:361)
at metabase.cmd.load_from_h2$load_from_h2_BANG_.invokeStatic(load_from_h2.clj:242)
at metabase.cmd.load_from_h2$load_from_h2_BANG_.invoke(load_from_h2.clj:236)
at clojure.lang.Var.invoke(Var.java:384)
at metabase.cmd$load_from_h2.invokeStatic(cmd.clj:37)
at metabase.cmd$load_from_h2.invoke(cmd.clj:30)
at clojure.lang.AFn.applyToHelper(AFn.java:154)
at clojure.lang.AFn.applyTo(AFn.java:144)
at clojure.core$apply.invokeStatic(core.clj:665)
at clojure.core$apply.invoke(core.clj:660)
at metabase.cmd$run_cmd$fn__69090.invoke(cmd.clj:127)
at metabase.cmd$run_cmd.invokeStatic(cmd.clj:127)
at metabase.cmd$run_cmd.invoke(cmd.clj:123)
at clojure.lang.Var.invoke(Var.java:388)
at metabase.core$run_cmd.invokeStatic(core.clj:129)
at metabase.core$run_cmd.invoke(core.clj:127)
at metabase.core$main.invokeStatic(core.clj:151)
at metabase.core$main.doInvoke(core.clj:146)
at clojure.lang.RestFn.applyTo(RestFn.java:137)
at metabase.core.main(Unknown Source)
Caused by: java.sql.SQLSyntaxErrorException: Could not connect to address=(host=localhost)(port=3306)(type=master) : (conn=1939) Unknown database 'metabase'
at org.mariadb.jdbc.internal.util.exceptions.ExceptionFactory.createException(ExceptionFactory.java:62)
at org.mariadb.jdbc.internal.util.exceptions.ExceptionFactory.create(ExceptionFactory.java:192)
at org.mariadb.jdbc.internal.protocol.AbstractConnectProtocol.connectWithoutProxy(AbstractConnectProtocol.java:1372)
at org.mariadb.jdbc.internal.util.Utils.retrieveProxy(Utils.java:635)
at org.mariadb.jdbc.MariaDbConnection.newConnection(MariaDbConnection.java:150)
at org.mariadb.jdbc.Driver.connect(Driver.java:89)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at clojure.java.jdbc$get_driver_connection.invokeStatic(jdbc.clj:271)
at clojure.java.jdbc$get_driver_connection.invoke(jdbc.clj:250)
at clojure.java.jdbc$get_connection.invokeStatic(jdbc.clj:411)
at clojure.java.jdbc$get_connection.invoke(jdbc.clj:274)
at clojure.java.jdbc$db_query_with_resultset_STAR
.invokeStatic(jdbc.clj:1111)
at clojure.java.jdbc$db_query_with_resultset_STAR
.invoke(jdbc.clj:1093)
at clojure.java.jdbc$query.invokeStatic(jdbc.clj:1182)
at clojure.java.jdbc$query.invoke(jdbc.clj:1144)
at clojure.java.jdbc$query.invokeStatic(jdbc.clj:1160)
at clojure.java.jdbc$query.invoke(jdbc.clj:1144)
at metabase.driver.sql_jdbc.connection$can_connect_QMARK_.invokeStatic(connection.clj:159)
at metabase.driver.sql_jdbc.connection$can_connect_QMARK_.invoke(connection.clj:154)
at metabase.driver.sql_jdbc$fn__73927.invokeStatic(sql_jdbc.clj:36)
at metabase.driver.sql_jdbc$fn__73927.invoke(sql_jdbc.clj:34)
at metabase.driver.mysql$fn__73058.invokeStatic(mysql.clj:76)
at metabase.driver.mysql$fn__73058.invoke(mysql.clj:72)
at clojure.lang.MultiFn.invoke(MultiFn.java:234)
at metabase.driver.util$can_connect_with_details_QMARK_$fn__22512.invoke(util.clj:35)
at metabase.util$do_with_timeout$fn__10225.invoke(util.clj:310)
at clojure.core$binding_conveyor_fn$fn__5754.invoke(core.clj:2030)
at clojure.lang.AFn.call(AFn.java:18)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.sql.SQLSyntaxErrorException: (conn=1939) Unknown database 'metabase'
at org.mariadb.jdbc.internal.util.exceptions.ExceptionFactory.createException(ExceptionFactory.java:62)
at org.mariadb.jdbc.internal.util.exceptions.ExceptionFactory.create(ExceptionFactory.java:187)
at org.mariadb.jdbc.internal.protocol.AbstractConnectProtocol.authenticationHandler(AbstractConnectProtocol.java:769)
at org.mariadb.jdbc.internal.protocol.AbstractConnectProtocol.createConnection(AbstractConnectProtocol.java:546)
at org.mariadb.jdbc.internal.protocol.AbstractConnectProtocol.connectWithoutProxy(AbstractConnectProtocol.java:1367)
... 30 more
Command failed with exception: Could not connect to address=(host=localhost)(port=3306)(type=master) : (conn=1939) Unknown database 'metabase'

@devna.muralee
You need to create the database in MySQL. Metabase does not create the database for you.
https://www.mysqltutorial.org/mysql-create-database/
And make sure you’re using utf8mb4 charset:
https://www.metabase.com/docs/latest/operations-guide/configuring-application-database.html#mysql-or-mariadb

I would highly recommend trying out our hosted solution instead:
https://www.metabase.com/start/hosted/

@flamber How do I know that migration to MYSQL is successful?

C:\Metabase>java -jar C:\Metabase\metabase.jar load-from-h2 metabase.db
09-28 23:17:39 e[1mINFO metabase.utile[0m :: Loading Metabase…
09-28 23:17:39 e[1mINFO metabase.utile[0m :: Maximum memory available to JVM: 862.5 MB
WARNING: not-empty already refers to: #'clojure.core/not-empty in namespace: metabase.mbql.schema, being replaced by: #'metabase.mbql.schema/not-empty
09-28 23:17:50 e[1mINFO util.encryptione[0m :: Saved credentials encryption is DISABLED for this Metabase instance.
For more information, see https://metabase.com/docs/latest/operations-guide/encrypting-database-details-at-rest.html
09-28 23:17:57 e[1mWARN metabase.coree[0m :: WARNING: You have enabled namespace tracing, which could log sensitive information like db passwords.
09-28 23:17:57 e[1mINFO metabase.dbe[0m :: Verifying mysql Database Connection …
09-28 23:17:57 e[1mINFO driver.imple[0m :: Registered abstract driver :sql
Load driver :sql took 95.9 ms
09-28 23:17:57 e[1mINFO driver.imple[0m :: Registered abstract driver :sql-jdbc (parents: [:sql])
Load driver :sql-jdbc took 111.0 ms
09-28 23:17:57 e[1mINFO driver.imple[0m :: Registered driver :mysql (parents: [:sql-jdbc])
Load driver :mysql took 208.1 ms
09-28 23:17:57 e[1mINFO driver.imple[0m :: Initializing driver :sql…
09-28 23:17:57 e[1mINFO driver.imple[0m :: Initializing driver :sql-jdbc…
09-28 23:17:57 e[1mINFO driver.imple[0m :: Initializing driver :mysql…
09-28 23:17:57 e[1mINFO metabase.dbe[0m :: Successfully verified MySQL 8.0.21 application database connection.
09-28 23:17:57 e[1mINFO metabase.dbe[0m :: Running Database Migrations…
09-28 23:17:57 e[1mINFO metabase.dbe[0m :: Setting up Liquibase…
09-28 23:17:57 e[1mINFO metabase.dbe[0m :: Liquibase is ready.
09-28 23:17:57 e[1mINFO db.liquibasee[0m :: Checking if Database has unrun migrations…
09-28 23:18:00 e[1mWARN changelog.DatabaseChangeLoge[0m :: modifyDataType will lose primary key/autoincrement/not null settings for mysql. Use and re-specify all configuration if this is the case
09-28 23:18:00 e[1mWARN changelog.DatabaseChangeLoge[0m :: modifyDataType will lose primary key/autoincrement/not null settings for mysql. Use and re-specify all configuration if this is the case
09-28 23:18:00 e[1mWARN changelog.DatabaseChangeLoge[0m :: modifyDataType will lose primary key/autoincrement/not null settings for mysql. Use and re-specify all configuration if this is the case
09-28 23:18:00 e[1mWARN changelog.DatabaseChangeLoge[0m :: modifyDataType will lose primary key/autoincrement/not null settings for mysql. Use and re-specify all configuration if this is the case
09-28 23:18:00 e[1mWARN changelog.DatabaseChangeLoge[0m :: modifyDataType will lose primary key/autoincrement/not null settings for mysql. Use and re-specify all configuration if this is the case
09-28 23:18:00 e[1mWARN changelog.DatabaseChangeLoge[0m :: modifyDataType will lose primary key/autoincrement/not null settings for mysql. Use and re-specify all configuration if this is the case
09-28 23:18:00 e[1mWARN changelog.DatabaseChangeLoge[0m :: modifyDataType will lose primary key/autoincrement/not null settings for mysql. Use and re-specify all configuration if this is the case
09-28 23:18:00 e[1mINFO db.liquibasee[0m :: Database has unrun migrations. Waiting for migration lock to be cleared…
09-28 23:18:00 e[1mWARN changelog.DatabaseChangeLoge[0m :: modifyDataType will lose primary key/autoincrement/not null settings for mysql. Use and re-specify all configuration if this is the case
09-28 23:18:00 e[1mWARN changelog.DatabaseChangeLoge[0m :: modifyDataType will lose primary key/autoincrement/not null settings for mysql. Use and re-specify all configuration if this is the case
09-28 23:18:00 e[1mWARN changelog.DatabaseChangeLoge[0m :: modifyDataType will lose primary key/autoincrement/not null settings for mysql. Use and re-specify all configuration if this is the case
09-28 23:18:00 e[1mWARN changelog.DatabaseChangeLoge[0m :: modifyDataType will lose primary key/autoincrement/not null settings for mysql. Use and re-specify all configuration if this is the case
09-28 23:18:00 e[1mWARN changelog.DatabaseChangeLoge[0m :: modifyDataType will lose primary key/autoincrement/not null settings for mysql. Use and re-specify all configuration if this is the case
09-28 23:18:00 e[1mWARN changelog.DatabaseChangeLoge[0m :: modifyDataType will lose primary key/autoincrement/not null settings for mysql. Use and re-specify all configuration if this is the case
09-28 23:18:00 e[1mWARN changelog.DatabaseChangeLoge[0m :: modifyDataType will lose primary key/autoincrement/not null settings for mysql. Use and re-specify all configuration if this is the case
09-28 23:18:00 e[1mINFO db.liquibasee[0m :: Migration lock is cleared. Running migrations…
09-28 23:18:00 e[1mWARN changelog.DatabaseChangeLoge[0m :: modifyDataType will lose primary key/autoincrement/not null settings for mysql. Use and re-specify all configuration if this is the case
09-28 23:18:00 e[1mWARN changelog.DatabaseChangeLoge[0m :: modifyDataType will lose primary key/autoincrement/not null settings for mysql. Use and re-specify all configuration if this is the case
09-28 23:18:00 e[1mWARN changelog.DatabaseChangeLoge[0m :: modifyDataType will lose primary key/autoincrement/not null settings for mysql. Use and re-specify all configuration if this is the case
09-28 23:18:00 e[1mWARN changelog.DatabaseChangeLoge[0m :: modifyDataType will lose primary key/autoincrement/not null settings for mysql. Use and re-specify all configuration if this is the case
09-28 23:18:00 e[1mWARN changelog.DatabaseChangeLoge[0m :: modifyDataType will lose primary key/autoincrement/not null settings for mysql. Use and re-specify all configuration if this is the case
09-28 23:18:00 e[1mWARN changelog.DatabaseChangeLoge[0m :: modifyDataType will lose primary key/autoincrement/not null settings for mysql. Use and re-specify all configuration if this is the case
09-28 23:18:00 e[1mWARN changelog.DatabaseChangeLoge[0m :: modifyDataType will lose primary key/autoincrement/not null settings for mysql. Use and re-specify all configuration if this is the case
09-28 23:18:20 e[1mINFO metabase.dbe[0m :: Database Migrations Current …
Database setup took 23.0 s
Testing if target DB is already populated…
e[32m[OK]e[0m
Temporarily disabling DB constraints…
e[32m[OK]e[0m
Transfering 2 instances of Database…e[34m.e[0me[32m[OK]e[0m
Transfering 1 instances of User…e[34m.e[0me[32m[OK]e[0m
Transfering 7 instances of Setting…e[34m.e[0me[32m[OK]e[0m
Transfering 7 instances of Table…e[34m.e[0me[32m[OK]e[0m
Transfering 49 instances of Field…e[34m.e[0me[32m[OK]e[0m
Transfering 13 instances of FieldValues…e[34m.e[0me[32m[OK]e[0m
Transfering 1 instances of Revision…e[34m.e[0me[32m[OK]e[0m
Transfering 2 instances of ViewLog…e[34m.e[0me[32m[OK]e[0m
Transfering 1 instances of Session…e[34m.e[0me[32m[OK]e[0m
Transfering 1 instances of Collection…e[34m.e[0me[32m[OK]e[0m
Transfering 1 instances of Card…e[34m.e[0me[32m[OK]e[0m
Transfering 3 instances of Activity…e[34m.e[0me[32m[OK]e[0m
Transfering 3 instances of PermissionsGroup…e[34m.e[0me[32m[OK]e[0m
Transfering 2 instances of PermissionsGroupMembership…e[34m.e[0me[32m[OK]e[0m
Transfering 5 instances of Permissions…e[34m.e[0me[32m[OK]e[0m
Transfering 13 instances of DataMigrations…e[34m.e[0me[32m[OK]e[0m
Re-enabling DB constraints…
e[32m[OK]e[0m

@devna.muralee That’s it. It has performed the migration without errors.
Now you move (or trash) the metabase.db.mv.db and metabase.db.trace.db
And then you start Metabase without load-from-h2 metabase.db

@flamber thanks a ton I was able to migrate and could launch the application without loss of previously created data(questions and dashboards). However, when I close Command Prompt, the application fails to start back up and when I run the jar file again it launches a new one where I have to set up a new account , also I see metabase.db.mv and trace files are created back in the folder.

Q1.Do I have to always open cmd prompt and run jar file every time I want to access http://localhost:3000/
q2.After the migration and setup (with just jar file in metabase folder) can I close cmd prompt and just manually load http://localhost:3000/? which is currently not happening if I close cmd prompt I cannot launch http://localhost:3000/, and if I re-run jar file its a fresh start … Excuse me for this but it would be of great help if you could guide me with this?

@devna.muralee
You have to set the environment variable every time or use Java properties:
https://www.metabase.com/docs/latest/operations-guide/environment-variables.html
You cannot close the prompt, since that’s what is executing the Java process. You would have to setup a service if you want this hidden. Search the forum or the internet for how to setup a Java application as a service on Windows.