Migrate H2 to mysql

Hi, every one!


this was closed, I'm oppenig here because its not working yet.

I'm trying to migrate h2 to mysql, but I'm getting the following message:
"Command failed with exception: ERROR Set up h2 source database and run migrations..."
and some times "shutdown metabase"

I configured schema
image

and I tried it:
set MB_DB_TYPE=mysql
set MB_DB_DBNAME=metabase
set MB_DB_PORT=3306
set MB_DB_USER=metabase
set MB_DB_PASS=metabase
set MB_DB_HOST=localhost
java -jar metabase.jar load-from-h2 /path/to/metabase.db

and it:
set MB_DB_TYPE=mysql
set MB_DB_DBNAME=metabase
set MB_DB_PORT=3306
set MB_DB_USER=metabase
set MB_DB_PASS=metabase
set MB_DB_HOST=localhost
MB_DB_FILE=C:\MetabaseTestes\Metabase0411\metabase.db
java -jar metabase.jar load-from-h2 /path/to/metabase.db

and it:
...
java -jar C:\MetabaseTestes\Metabase0411\metabase.jar load-from-h2 C:\MetabaseTestes\Metabase0411\metabase.db

And others more... I dont know what can I do.

ps: I'm using windows, and localhost:3000

Hi @anapaula
You need to provide the full logs, not just what snippets.

You are trying too many things that the same time.

I don't know what your H2 file is called, but I'm guessing it's metabase.db.mv.db and I'm guessing it's located in C:\MetabaseTestes\Metabase0411

Then start by changing to the directory, so you don't have to deal with it:

cd C:\MetabaseTestes\Metabase0411

Then set the environment variables:

set MB_DB_TYPE=mysql
set MB_DB_DBNAME=metabase
set MB_DB_PORT=3306
set MB_DB_USER=metabase
set MB_DB_PASS=metabase
set MB_DB_HOST=localhost
set MB_DB_FILE=metabase.db

And then run the migration:

java -jar metabase.jar load-from-h2

Hi @flamber

Yes, you are correct!

i'm doing exactly that.

.................

C:\MetabaseTestes\Metabase0411>set MB_DB_TYPE=mysql

C:\MetabaseTestes\Metabase0411>set MB_DB_DBNAME=metabase

C:\MetabaseTestes\Metabase0411>set MB_DB_PORT=3306

C:\MetabaseTestes\Metabase0411>set MB_DB_USER=metabase

C:\MetabaseTestes\Metabase0411>set MB_DB_PASS=metabase

C:\MetabaseTestes\Metabase0411>set MB_DB_HOST=localhost

C:\MetabaseTestes\Metabase0411>java -jar metabase.jar load-from-h2 /path/to/metabase.db
WARNING: sun.reflect.Reflection.getCallerClass is not supported. This will impact performance.
2021-10-28 15:31:29,159 INFO metabase.util :: Maximum memory available to JVM: 2,0 GB
2021-10-28 15:31:40,705 INFO util.encryption :: 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
2021-10-28 15:31:45,665 INFO metabase.core ::
Metabase v0.40.3.1 (0550b86 release-x.40.x)

Copyright ® 2021 Metabase, Inc.

Metabase Enterprise Edition extensions are NOT PRESENT.
2021-10-28 15:31:45,675 WARN metabase.core :: WARNING: You have enabled namespace tracing, which could log sensitive information like db passwords.
2021-10-28 15:31:45,727 INFO cmd.copy :: Set up h2 source database and run migrations...
2021-10-28 15:31:45,731 INFO db.setup :: Verifying h2 Database Connection ...
2021-10-28 15:31:45,794 ERROR cmd.copy :: [FAIL]

clojure.lang.ExceptionInfo: ERROR Set up h2 source database and run migrations... {}
at metabase.cmd.copy$do_step$fn__77867.invoke(copy.clj:33)
at metabase.cmd.copy$do_step.invokeStatic(copy.clj:29)
at metabase.cmd.copy$do_step.invoke(copy.clj:27)
at metabase.cmd.copy$fn__78028$copy_BANG___78033$fn__78034.invoke(copy.clj:263)
at metabase.cmd.copy$fn__78028$copy_BANG___78033.invoke(copy.clj:256)
at metabase.cmd.load_from_h2$load_from_h2_BANG_.invokeStatic(load_from_h2.clj:35)
at metabase.cmd.load_from_h2$load_from_h2_BANG_.invoke(load_from_h2.clj:25)
at clojure.lang.Var.invoke(Var.java:384)
at metabase.cmd$load_from_h2.invokeStatic(cmd.clj:45)
at metabase.cmd$load_from_h2.invoke(cmd.clj:39)
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__77585.invoke(cmd.clj:191)
at metabase.cmd$run_cmd.invokeStatic(cmd.clj:191)
at metabase.cmd$run_cmd.invoke(cmd.clj:187)
at clojure.lang.Var.invoke(Var.java:388)
at metabase.core$run_cmd.invokeStatic(core.clj:141)
at metabase.core$run_cmd.invoke(core.clj:139)
at metabase.core$main.invokeStatic(core.clj:163)
at metabase.core$main.doInvoke(core.clj:158)
at clojure.lang.RestFn.applyTo(RestFn.java:137)
at metabase.core.main(Unknown Source)
Caused by: clojure.lang.ExceptionInfo: Unable to connect to Metabase h2 DB. {}
at metabase.db.setup$fn__35708$verify_db_connection__35713$fn__35714$fn__35715.invoke(setup.clj:102)
at metabase.db.setup$fn__35708$verify_db_connection__35713$fn__35714.invoke(setup.clj:100)
at metabase.db.setup$fn__35708$verify_db_connection__35713.invoke(setup.clj:94)
at metabase.db.setup$setup_db_BANG
$fn__35743$fn__35744.invoke(setup.clj:142)
at metabase.util$do_with_us_locale.invokeStatic(util.clj:683)
at metabase.util$do_with_us_locale.invoke(util.clj:669)
at metabase.db.setup$setup_db_BANG
$fn__35743.invoke(setup.clj:141)
at metabase.db.setup$setup_db_BANG_.invokeStatic(setup.clj:140)
at metabase.db.setup$setup_db_BANG_.invoke(setup.clj:136)
at metabase.cmd.copy$fn__78028$copy_BANG___78033$fn__78034$fn__78035.invoke(copy.clj:264)
at metabase.cmd.copy$do_step$fn__77867.invoke(copy.clj:30)
... 23 more
Caused by: org.h2.jdbc.JdbcSQLException: Database "C:/path/to/metabase.db" not found [90013-197]
at org.h2.message.DbException.getJdbcSQLException(DbException.java:357)
at org.h2.message.DbException.get(DbException.java:179)
at org.h2.message.DbException.get(DbException.java:155)
at org.h2.engine.Engine.openSession(Engine.java:64)
at org.h2.engine.Engine.openSession(Engine.java:179)
at org.h2.engine.Engine.createSessionAndValidate(Engine.java:157)
at org.h2.engine.Engine.createSession(Engine.java:140)
at org.h2.engine.Engine.createSession(Engine.java:28)
at org.h2.engine.SessionRemote.connectEmbeddedOrServer(SessionRemote.java:351)
at org.h2.jdbc.JdbcConnection.(JdbcConnection.java:124)
at org.h2.jdbc.JdbcConnection.(JdbcConnection.java:103)
at org.h2.Driver.connect(Driver.java:69)
at java.sql/java.sql.DriverManager.getConnection(DriverManager.java:681)
at java.sql/java.sql.DriverManager.getConnection(DriverManager.java:190)
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_with_spec_QMARK_.invokeStatic(connection.clj:201)
at metabase.driver.sql_jdbc.connection$can_connect_with_spec_QMARK_.invoke(connection.clj:198)
at metabase.db.setup$fn__35708$verify_db_connection__35713$fn__35714$fn__35715.invoke(setup.clj:100)
... 33 more
Command failed with exception: ERROR Set up h2 source database and run migrations...

C:\MetabaseTestes\Metabase0411>

@anapaula You are not doing what I write. Please re-do exactly what I wrote - absolutely nothing else.

@flamber
Sorry, I did it too.


and the failed

C:\MetabaseTestes\Metabase0411>java -jar metabase.jar load-from-h2
WARNING: sun.reflect.Reflection.getCallerClass is not supported. This will impact performance.
2021-10-28 15:58:01,587 INFO metabase.util :: Maximum memory available to JVM: 2,0 GB
2021-10-28 15:58:12,897 INFO util.encryption :: 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
2021-10-28 15:58:20,350 INFO metabase.core ::
Metabase v0.40.3.1 (0550b86 release-x.40.x)

Copyright ® 2021 Metabase, Inc.

Metabase Enterprise Edition extensions are NOT PRESENT.
2021-10-28 15:58:20,368 WARN metabase.core :: WARNING: You have enabled namespace tracing, which could log sensitive information like db passwords.
2021-10-28 15:58:20,410 INFO cmd.copy :: Set up h2 source database and run migrations...
2021-10-28 15:58:20,412 INFO db.setup :: Verifying h2 Database Connection ...
2021-10-28 15:58:20,480 ERROR cmd.copy :: [FAIL]

clojure.lang.ExceptionInfo: ERROR Set up h2 source database and run migrations... {}
at metabase.cmd.copy$do_step$fn__77867.invoke(copy.clj:33)
at metabase.cmd.copy$do_step.invokeStatic(copy.clj:29)
at metabase.cmd.copy$do_step.invoke(copy.clj:27)
at metabase.cmd.copy$fn__78028$copy_BANG___78033$fn__78034.invoke(copy.clj:263)
at metabase.cmd.copy$fn__78028$copy_BANG___78033.invoke(copy.clj:256)
at metabase.cmd.load_from_h2$load_from_h2_BANG_.invokeStatic(load_from_h2.clj:35)
at metabase.cmd.load_from_h2$load_from_h2_BANG_.invoke(load_from_h2.clj:25)
at clojure.lang.Var.invoke(Var.java:384)
at metabase.cmd$load_from_h2.invokeStatic(cmd.clj:45)
at metabase.cmd$load_from_h2.invoke(cmd.clj:39)
at metabase.cmd$load_from_h2.invokeStatic(cmd.clj:42)
at metabase.cmd$load_from_h2.invoke(cmd.clj:39)
at clojure.lang.AFn.applyToHelper(AFn.java:152)
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__77585.invoke(cmd.clj:191)
at metabase.cmd$run_cmd.invokeStatic(cmd.clj:191)
at metabase.cmd$run_cmd.invoke(cmd.clj:187)
at clojure.lang.Var.invoke(Var.java:388)
at metabase.core$run_cmd.invokeStatic(core.clj:141)
at metabase.core$run_cmd.invoke(core.clj:139)
at metabase.core$main.invokeStatic(core.clj:163)
at metabase.core$main.doInvoke(core.clj:158)
at clojure.lang.RestFn.applyTo(RestFn.java:137)
at metabase.core.main(Unknown Source)
Caused by: clojure.lang.ExceptionInfo: Unable to connect to Metabase h2 DB. {}
at metabase.db.setup$fn__35708$verify_db_connection__35713$fn__35714$fn__35715.invoke(setup.clj:102)
at metabase.db.setup$fn__35708$verify_db_connection__35713$fn__35714.invoke(setup.clj:100)
at metabase.db.setup$fn__35708$verify_db_connection__35713.invoke(setup.clj:94)
at metabase.db.setup$setup_db_BANG
$fn__35743$fn__35744.invoke(setup.clj:142)
at metabase.util$do_with_us_locale.invokeStatic(util.clj:683)
at metabase.util$do_with_us_locale.invoke(util.clj:669)
at metabase.db.setup$setup_db_BANG
$fn__35743.invoke(setup.clj:141)
at metabase.db.setup$setup_db_BANG_.invokeStatic(setup.clj:140)
at metabase.db.setup$setup_db_BANG_.invoke(setup.clj:136)
at metabase.cmd.copy$fn__78028$copy_BANG___78033$fn__78034$fn__78035.invoke(copy.clj:264)
at metabase.cmd.copy$do_step$fn__77867.invoke(copy.clj:30)
... 25 more
Caused by: org.h2.jdbc.JdbcSQLException: Invalid database name: "C:\MetabaseTestes\Metabase0411" [90138-197]
at org.h2.message.DbException.getJdbcSQLException(DbException.java:357)
at org.h2.message.DbException.get(DbException.java:179)
at org.h2.message.DbException.get(DbException.java:155)
at org.h2.engine.ConnectionInfo.getName(ConnectionInfo.java:404)
at org.h2.engine.Engine.openSession(Engine.java:50)
at org.h2.engine.Engine.openSession(Engine.java:179)
at org.h2.engine.Engine.createSessionAndValidate(Engine.java:157)
at org.h2.engine.Engine.createSession(Engine.java:140)
at org.h2.engine.Engine.createSession(Engine.java:28)
at org.h2.engine.SessionRemote.connectEmbeddedOrServer(SessionRemote.java:351)
at org.h2.jdbc.JdbcConnection.(JdbcConnection.java:124)
at org.h2.jdbc.JdbcConnection.(JdbcConnection.java:103)
at org.h2.Driver.connect(Driver.java:69)
at java.sql/java.sql.DriverManager.getConnection(DriverManager.java:681)
at java.sql/java.sql.DriverManager.getConnection(DriverManager.java:190)
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_with_spec_QMARK_.invokeStatic(connection.clj:201)
at metabase.driver.sql_jdbc.connection$can_connect_with_spec_QMARK_.invoke(connection.clj:198)
at metabase.db.setup$fn__35708$verify_db_connection__35713$fn__35714$fn__35715.invoke(setup.clj:100)
... 35 more
Command failed with exception: ERROR Set up h2 source database and run migrations...

C:\MetabaseTestes\Metabase0411>

@anapaula You need to provide the entire log, not screenshots. All the important information is not available.

1 Like

@anapaula Run this:

java -jar metabase.jar load-from-h2 metabase.db

C:\MetabaseTestes\Metabase0411>set MB_DB_TYPE=mysql

C:\MetabaseTestes\Metabase0411>set MB_DB_DBNAME=metabase

C:\MetabaseTestes\Metabase0411>set MB_DB_PORT=3306

C:\MetabaseTestes\Metabase0411>set MB_DB_USER=metabase

C:\MetabaseTestes\Metabase0411>set MB_DB_PASS=metabase

C:\MetabaseTestes\Metabase0411>set MB_DB_HOST=localhost

C:\MetabaseTestes\Metabase0411>set MB_DB_FILE=metabase.db

C:\MetabaseTestes\Metabase0411>java -jar metabase.jar load-from-h2 metabase.db
WARNING: sun.reflect.Reflection.getCallerClass is not supported. This will impact performance.
2021-10-28 16:07:11,690 INFO metabase.util :: Maximum memory available to JVM: 2,0 GB
2021-10-28 16:07:21,869 INFO util.encryption :: 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
2021-10-28 16:07:26,378 INFO metabase.core ::
Metabase v0.40.3.1 (0550b86 release-x.40.x)

Copyright ® 2021 Metabase, Inc.

Metabase Enterprise Edition extensions are NOT PRESENT.
2021-10-28 16:07:26,387 WARN metabase.core :: WARNING: You have enabled namespace tracing, which could log sensitive information like db passwords.
2021-10-28 16:07:26,425 INFO cmd.copy :: Set up h2 source database and run migrations...
2021-10-28 16:07:26,428 INFO db.setup :: Verifying h2 Database Connection ...
2021-10-28 16:07:26,999 INFO db.setup :: Successfully verified H2 1.4.197 (2018-03-18) application database connection.
2021-10-28 16:07:27,000 INFO db.setup :: Running Database Migrations...
2021-10-28 16:07:27,003 INFO db.setup :: Setting up Liquibase...
2021-10-28 16:07:27,053 INFO db.setup :: Liquibase is ready.
2021-10-28 16:07:27,066 INFO db.liquibase :: Checking if Database has unrun migrations...
2021-10-28 16:07:28,769 INFO db.setup :: Database Migrations Current ...
2021-10-28 16:07:28,770 INFO db.data-migrations :: Running all necessary data migrations, this may take a minute.
2021-10-28 16:07:28,783 INFO db.data-migrations :: Finished running data migrations.
Database setup took 2,4 s
2021-10-28 16:07:28,785 INFO cmd.copy :: [OK]
2021-10-28 16:07:28,786 INFO cmd.copy :: Set up mysql target database and run migrations...
2021-10-28 16:07:28,786 INFO db.setup :: Verifying mysql Database Connection ...
2021-10-28 16:07:29,015 ERROR cmd.copy :: [FAIL]

clojure.lang.ExceptionInfo: ERROR Set up mysql target database and run migrations... {}
at metabase.cmd.copy$do_step$fn__77867.invoke(copy.clj:33)
at metabase.cmd.copy$do_step.invokeStatic(copy.clj:29)
at metabase.cmd.copy$do_step.invoke(copy.clj:27)
at metabase.cmd.copy$fn__78028$copy_BANG___78033$fn__78034.invoke(copy.clj:268)
at metabase.cmd.copy$fn__78028$copy_BANG___78033.invoke(copy.clj:256)
at metabase.cmd.load_from_h2$load_from_h2_BANG_.invokeStatic(load_from_h2.clj:35)
at metabase.cmd.load_from_h2$load_from_h2_BANG_.invoke(load_from_h2.clj:25)
at clojure.lang.Var.invoke(Var.java:384)
at metabase.cmd$load_from_h2.invokeStatic(cmd.clj:45)
at metabase.cmd$load_from_h2.invoke(cmd.clj:39)
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__77585.invoke(cmd.clj:191)
at metabase.cmd$run_cmd.invokeStatic(cmd.clj:191)
at metabase.cmd$run_cmd.invoke(cmd.clj:187)
at clojure.lang.Var.invoke(Var.java:388)
at metabase.core$run_cmd.invokeStatic(core.clj:141)
at metabase.core$run_cmd.invoke(core.clj:139)
at metabase.core$main.invokeStatic(core.clj:163)
at metabase.core$main.doInvoke(core.clj:158)
at clojure.lang.RestFn.applyTo(RestFn.java:137)
at metabase.core.main(Unknown Source)
Caused by: clojure.lang.ExceptionInfo: Unable to connect to Metabase mysql DB. {}
at metabase.db.setup$fn__35708$verify_db_connection__35713$fn__35714$fn__35715.invoke(setup.clj:102)
at metabase.db.setup$fn__35708$verify_db_connection__35713$fn__35714.invoke(setup.clj:100)
at metabase.db.setup$fn__35708$verify_db_connection__35713.invoke(setup.clj:94)
at metabase.db.setup$setup_db_BANG
$fn__35743$fn__35744.invoke(setup.clj:142)
at metabase.util$do_with_us_locale.invokeStatic(util.clj:683)
at metabase.util$do_with_us_locale.invoke(util.clj:669)
at metabase.db.setup$setup_db_BANG
$fn__35743.invoke(setup.clj:141)
at metabase.db.setup$setup_db_BANG_.invokeStatic(setup.clj:140)
at metabase.db.setup$setup_db_BANG_.invoke(setup.clj:136)
at metabase.cmd.copy$fn__78028$copy_BANG___78033$fn__78034$fn__78037.invoke(copy.clj:270)
at metabase.cmd.copy$do_step$fn__77867.invoke(copy.clj:30)
... 23 more
Caused by: java.sql.SQLTransientConnectionException: Could not connect to address=(host=localhost)(port=3306)(type=master) : RSA public key is not available client side (option serverRsaPublicKeyFile not set)
at org.mariadb.jdbc.internal.util.exceptions.ExceptionFactory.createException(ExceptionFactory.java:79)
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/java.sql.DriverManager.getConnection(DriverManager.java:681)
at java.sql/java.sql.DriverManager.getConnection(DriverManager.java:190)
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_with_spec_QMARK_.invokeStatic(connection.clj:201)
at metabase.driver.sql_jdbc.connection$can_connect_with_spec_QMARK_.invoke(connection.clj:198)
at metabase.db.setup$fn__35708$verify_db_connection__35713$fn__35714$fn__35715.invoke(setup.clj:100)
... 33 more
Caused by: java.sql.SQLException: RSA public key is not available client side (option serverRsaPublicKeyFile not set)
at org.mariadb.jdbc.internal.com.send.authentication.CachingSha2PasswordPlugin.process(CachingSha2PasswordPlugin.java:189)
at org.mariadb.jdbc.internal.protocol.AbstractConnectProtocol.authenticationHandler(AbstractConnectProtocol.java:745)
at org.mariadb.jdbc.internal.protocol.AbstractConnectProtocol.createConnection(AbstractConnectProtocol.java:546)
at org.mariadb.jdbc.internal.protocol.AbstractConnectProtocol.connectWithoutProxy(AbstractConnectProtocol.java:1367)
... 51 more
Command failed with exception: ERROR Set up mysql target database and run migrations...

C:\MetabaseTestes\Metabase0411>

@anapaula The error is Unable to connect to Metabase mysql DB, meaning the credentials are not correct for the MySQL, but now it reads the H2 correctly.

1 Like

I dont know any more... :expressionless:

CREATE SCHEMA metabase
CREATE USER 'metabase'@'localhost' IDENTIFIED BY 'metabase';
GRANT ALL PRIVILEGES ON * . * TO 'metabase'@'localhost';

@anapaula Do this:

CREATE USER 'metabase'@'localhost' IDENTIFIED WITH mysql_native_password BY 'metabase';

C:\MetabaseTestes\Metabase0411>set MB_DB_TYPE=mysql

C:\MetabaseTestes\Metabase0411>set MB_DB_DBNAME=metabase

C:\MetabaseTestes\Metabase0411>set MB_DB_PORT=3306

C:\MetabaseTestes\Metabase0411>set MB_DB_USER=metabase

C:\MetabaseTestes\Metabase0411>set MB_DB_PASS=metabase

C:\MetabaseTestes\Metabase0411>set MB_DB_HOST=localhost

C:\MetabaseTestes\Metabase0411>set MB_DB_FILE=metabase.db

C:\MetabaseTestes\Metabase0411>
C:\MetabaseTestes\Metabase0411>java -jar metabase.jar load-from-h2 metabase.db
WARNING: sun.reflect.Reflection.getCallerClass is not supported. This will impact performance.
2021-10-28 16:28:21,753 INFO metabase.util :: Maximum memory available to JVM: 2,0 GB
2021-10-28 16:28:32,810 INFO util.encryption :: 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
2021-10-28 16:28:37,387 INFO metabase.core ::
Metabase v0.40.3.1 (0550b86 release-x.40.x)

Copyright ® 2021 Metabase, Inc.

Metabase Enterprise Edition extensions are NOT PRESENT.
2021-10-28 16:28:37,395 WARN metabase.core :: WARNING: You have enabled namespace tracing, which could log sensitive information like db passwords.
2021-10-28 16:28:37,435 INFO cmd.copy :: Set up h2 source database and run migrations...
2021-10-28 16:28:37,438 INFO db.setup :: Verifying h2 Database Connection ...
2021-10-28 16:28:37,696 INFO db.setup :: Successfully verified H2 1.4.197 (2018-03-18) application database connection.
2021-10-28 16:28:37,697 INFO db.setup :: Running Database Migrations...
2021-10-28 16:28:37,701 INFO db.setup :: Setting up Liquibase...
2021-10-28 16:28:37,747 INFO db.setup :: Liquibase is ready.
2021-10-28 16:28:37,750 INFO db.liquibase :: Checking if Database has unrun migrations...
2021-10-28 16:28:39,418 INFO db.setup :: Database Migrations Current ...
2021-10-28 16:28:39,419 INFO db.data-migrations :: Running all necessary data migrations, this may take a minute.
2021-10-28 16:28:39,430 INFO db.data-migrations :: Finished running data migrations.
Database setup took 2,0 s
2021-10-28 16:28:39,432 INFO cmd.copy :: [OK]
2021-10-28 16:28:39,434 INFO cmd.copy :: Set up mysql target database and run migrations...
2021-10-28 16:28:39,434 INFO db.setup :: Verifying mysql Database Connection ...
2021-10-28 16:28:39,528 INFO db.setup :: Successfully verified MySQL 8.0.27 application database connection.
2021-10-28 16:28:39,532 INFO db.setup :: Running Database Migrations...
2021-10-28 16:28:39,551 INFO db.setup :: Setting up Liquibase...
2021-10-28 16:28:39,609 INFO db.setup :: Liquibase is ready.
2021-10-28 16:28:39,610 INFO db.liquibase :: Checking if Database has unrun migrations...
2021-10-28 16:28:43,109 WARN changelog.DatabaseChangeLog :: modifyDataType will lose primary key/autoincrement/not null settings for mysql. Use and re-specify all configuration if this is the case
2021-10-28 16:28:43,109 WARN changelog.DatabaseChangeLog :: modifyDataType will lose primary key/autoincrement/not null settings for mysql. Use and re-specify all configuration if this is the case
2021-10-28 16:28:43,111 WARN changelog.DatabaseChangeLog :: modifyDataType will lose primary key/autoincrement/not null settings for mysql. Use and re-specify all configuration if this is the case
2021-10-28 16:28:43,116 WARN changelog.DatabaseChangeLog :: modifyDataType will lose primary key/autoincrement/not null settings for mysql. Use and re-specify all configuration if this is the case
2021-10-28 16:28:43,117 WARN changelog.DatabaseChangeLog :: modifyDataType will lose primary key/autoincrement/not null settings for mysql. Use and re-specify all configuration if this is the case
2021-10-28 16:28:43,117 WARN changelog.DatabaseChangeLog :: modifyDataType will lose primary key/autoincrement/not null settings for mysql. Use and re-specify all configuration if this is the case
2021-10-28 16:28:43,118 WARN changelog.DatabaseChangeLog :: modifyDataType will lose primary key/autoincrement/not null settings for mysql. Use and re-specify all configuration if this is the case
2021-10-28 16:28:43,119 WARN changelog.DatabaseChangeLog :: modifyDataType will lose primary key/autoincrement/not null settings for mysql. Use and re-specify all configuration if this is the case
2021-10-28 16:28:43,122 INFO db.liquibase :: Database has unrun migrations. Waiting for migration lock to be cleared...
2021-10-28 16:28:43,200 WARN changelog.DatabaseChangeLog :: modifyDataType will lose primary key/autoincrement/not null settings for mysql. Use and re-specify all configuration if this is the case
2021-10-28 16:28:43,200 WARN changelog.DatabaseChangeLog :: modifyDataType will lose primary key/autoincrement/not null settings for mysql. Use and re-specify all configuration if this is the case
2021-10-28 16:28:43,202 WARN changelog.DatabaseChangeLog :: modifyDataType will lose primary key/autoincrement/not null settings for mysql. Use and re-specify all configuration if this is the case
2021-10-28 16:28:43,205 WARN changelog.DatabaseChangeLog :: modifyDataType will lose primary key/autoincrement/not null settings for mysql. Use and re-specify all configuration if this is the case
2021-10-28 16:28:43,205 WARN changelog.DatabaseChangeLog :: modifyDataType will lose primary key/autoincrement/not null settings for mysql. Use and re-specify all configuration if this is the case
2021-10-28 16:28:43,206 WARN changelog.DatabaseChangeLog :: modifyDataType will lose primary key/autoincrement/not null settings for mysql. Use and re-specify all configuration if this is the case
2021-10-28 16:28:43,206 WARN changelog.DatabaseChangeLog :: modifyDataType will lose primary key/autoincrement/not null settings for mysql. Use and re-specify all configuration if this is the case
2021-10-28 16:28:43,207 WARN changelog.DatabaseChangeLog :: modifyDataType will lose primary key/autoincrement/not null settings for mysql. Use and re-specify all configuration if this is the case
2021-10-28 16:28:43,208 INFO db.liquibase :: Migration lock is cleared. Running migrations...
2021-10-28 16:28:43,358 WARN changelog.DatabaseChangeLog :: modifyDataType will lose primary key/autoincrement/not null settings for mysql. Use and re-specify all configuration if this is the case
2021-10-28 16:28:43,359 WARN changelog.DatabaseChangeLog :: modifyDataType will lose primary key/autoincrement/not null settings for mysql. Use and re-specify all configuration if this is the case
2021-10-28 16:28:43,362 WARN changelog.DatabaseChangeLog :: modifyDataType will lose primary key/autoincrement/not null settings for mysql. Use and re-specify all configuration if this is the case
2021-10-28 16:28:43,365 WARN changelog.DatabaseChangeLog :: modifyDataType will lose primary key/autoincrement/not null settings for mysql. Use and re-specify all configuration if this is the case
2021-10-28 16:28:43,366 WARN changelog.DatabaseChangeLog :: modifyDataType will lose primary key/autoincrement/not null settings for mysql. Use and re-specify all configuration if this is the case
2021-10-28 16:28:43,367 WARN changelog.DatabaseChangeLog :: modifyDataType will lose primary key/autoincrement/not null settings for mysql. Use and re-specify all configuration if this is the case
2021-10-28 16:28:43,368 WARN changelog.DatabaseChangeLog :: modifyDataType will lose primary key/autoincrement/not null settings for mysql. Use and re-specify all configuration if this is the case
2021-10-28 16:28:43,369 WARN changelog.DatabaseChangeLog :: modifyDataType will lose primary key/autoincrement/not null settings for mysql. Use and re-specify all configuration if this is the case

@anapaula Migration will take a while. Ignore those warnings.

1 Like

Thanks,
I will wait :smiley:

@anapaula When it's done, then you'll do this:

  1. Move the metabase.db.mv.db to somewhere else (just for safe-keeping, backup)
  2. Start normally without the load-from-h2 metabase.db parameter.
    java -jar metabase.jar
  3. Then you validate that it's using MySQL as application database by going to Admin > Troubleshooting > look in "Diagnostic Info" for "application-database: mysql".
  4. And then you should upgrade to at least 0.40.5 or the latest 0.41.1.
    Make sure you always have backups of the application database before upgrading.
    https://github.com/metabase/metabase/releases
1 Like

@flamber
Thank you so much for your help.
Thank you very, very, very much! Realy!:smile_face_with_three_hearts:

{
"browser-info": {
"language": "pt",
"platform": "Win32",
"userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.54 Safari/537.36",
"vendor": "Google Inc."
},
"system-info": {
"file.encoding": "Cp1252",
"java.runtime.name": "Java(TM) SE Runtime Environment",
"java.runtime.version": "17.0.1+12-LTS-39",
"java.vendor": "Oracle Corporation",
"java.vendor.url": "https://java.oracle.com/",
"java.version": "17.0.1",
"java.vm.name": "Java HotSpot(TM) 64-Bit Server VM",
"java.vm.version": "17.0.1+12-LTS-39",
"os.name": "Windows 10",
"os.version": "10.0",
"user.language": "pt",
"user.timezone": "America/Sao_Paulo"
},
"metabase-info": {
"databases": [
"h2"
],
"hosting-env": "unknown",
"application-database": "mysql",
"application-database-details": {
"database": {
"name": "MySQL",
"version": "8.0.27"
},
"jdbc-driver": {
"name": "MariaDB Connector/J",
"version": "2.6.2"
}
},
"run-mode": "prod",
"version": {
"date": "2021-08-26",
"tag": "v0.40.3.1",
"branch": "release-x.40.x",
"hash": "0550b86"
},
"settings": {
"report-timezone": null
}
}
}

1 Like