Migration from h2 to mysql5.7 failed

I try to migrate a database from h2 to MySQL but data not migrated and metabase started

Migrating from using the H2 database to MySQL or Postgres

[root@tam-dboard-app03 sbin]# ./metabase.sh start
./metabase.sh: line 18: kill: (4203) - No such process
Starting Metabase…
11-22 11:19:17 INFO metabase.util :: Loading Metabase…
11-22 11:19:19 INFO util.encryption :: Saved credentials encryption is DISABLED for this Metabase instance. :unlock:
For more information, see https://www.metabase.com/docs/latest/operations-guide/start.html#encrypting-your-database-connection-details-at-rest
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by io.netty.util.internal.ReflectionUtil (file:/usr/share/metabase/metabase.jar) to constructor java.nio.DirectByteBuffer(long,int)
WARNING: Please consider reporting this to the maintainers of io.netty.util.internal.ReflectionUtil
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
11-22 11:19:24 INFO metabase.db :: Verifying mysql Database Connection …
11-22 11:19:25 INFO metabase.db :: Verify Database Connection … :white_check_mark:
11-22 11:19:25 INFO metabase.db :: Running Database Migrations…
Thu Nov 22 11:19:25 AST 2018 WARN: Establishing SSL connection without server’s identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn’t set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to ‘false’. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.
11-22 11:19:25 INFO metabase.db :: Setting up Liquibase…
Thu Nov 22 11:19:25 AST 2018 WARN: Establishing SSL connection without server’s identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn’t set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to ‘false’. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.
Thu Nov 22 11:19:25 AST 2018 WARN: Caught while disconnecting…

EXCEPTION STACK TRACE:

** BEGIN NESTED EXCEPTION **

javax.net.ssl.SSLException
MESSAGE: closing inbound before receiving peer’s close_notify

STACKTRACE:

javax.net.ssl.SSLException: closing inbound before receiving peer’s close_notify
at java.base/sun.security.ssl.Alert.createSSLException(Alert.java:129)
at java.base/sun.security.ssl.Alert.createSSLException(Alert.java:117)
at java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:308)
at java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:264)
at java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:255)
at java.base/sun.security.ssl.SSLSocketImpl.shutdownInput(SSLSocketImpl.java:645)
at java.base/sun.security.ssl.SSLSocketImpl.shutdownInput(SSLSocketImpl.java:624)
at com.mysql.jdbc.MysqlIO.quit(MysqlIO.java:2246)
at com.mysql.jdbc.ConnectionImpl.realClose(ConnectionImpl.java:4236)
at com.mysql.jdbc.ConnectionImpl.close(ConnectionImpl.java:1462)
at metabase.db$consolidate_liquibase_changesets$fn__15411.invoke(db.clj:240)
at metabase.db$consolidate_liquibase_changesets.invokeStatic(db.clj:240)
at metabase.db$consolidate_liquibase_changesets.invoke(db.clj:228)
at metabase.db$migrate_BANG_$fn__15423.invoke(db.clj:285)
at clojure.java.jdbc$db_transaction_STAR_.invokeStatic(jdbc.clj:747)
at clojure.java.jdbc$db_transaction_STAR_.invoke(jdbc.clj:717)
at clojure.java.jdbc$db_transaction_STAR_.invokeStatic(jdbc.clj:782)
at clojure.java.jdbc$db_transaction_STAR_.invoke(jdbc.clj:717)
at clojure.java.jdbc$db_transaction_STAR_.invokeStatic(jdbc.clj:730)
at clojure.java.jdbc$db_transaction_STAR_.invoke(jdbc.clj:717)
at metabase.db$migrate_BANG_.invokeStatic(db.clj:276)
at metabase.db$migrate_BANG_.invoke(db.clj:257)
at metabase.db$run_schema_migrations_BANG_$fn__15456.invoke(db.clj:435)
at metabase.util$do_with_auto_retries.invokeStatic(util.clj:411)
at metabase.util$do_with_auto_retries.invoke(util.clj:402)
at metabase.db$run_schema_migrations_BANG_.invokeStatic(db.clj:434)
at metabase.db$run_schema_migrations_BANG_.invoke(db.clj:417)
at metabase.db$setup_db_BANG_.invokeStatic(db.clj:453)
at metabase.db$setup_db_BANG_.doInvoke(db.clj:446)
at clojure.lang.RestFn.invoke(RestFn.java:397)
at metabase.cmd.load_from_h2$load_from_h2_BANG_.invokeStatic(load_from_h2.clj:215)
at metabase.cmd.load_from_h2$load_from_h2_BANG_.invoke(load_from_h2.clj:209)
at clojure.lang.Var.invoke(Var.java:381)
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:657)
at clojure.core$apply.invoke(core.clj:652)
at metabase.cmd$run_cmd$fn__56205.invoke(cmd.clj:133)
at metabase.cmd$run_cmd.invokeStatic(cmd.clj:133)
at metabase.cmd$run_cmd.invoke(cmd.clj:129)
at clojure.lang.Var.invoke(Var.java:385)
at metabase.core$run_cmd.invokeStatic(core.clj:256)
at metabase.core$run_cmd.invoke(core.clj:254)
at metabase.core$_main.invokeStatic(core.clj:265)
at metabase.core$_main.doInvoke(core.clj:261)
at clojure.lang.RestFn.applyTo(RestFn.java:137)
at metabase.core.main(Unknown Source)

** END NESTED EXCEPTION **

11-22 11:19:25 INFO metabase.db :: Liquibase is ready.
11-22 11:19:25 INFO metabase.db :: Checking if Database has unrun migrations…
11-22 11:19:27 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
11-22 11:19:27 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
11-22 11:19:27 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
11-22 11:19:27 INFO metabase.db :: Database has unrun migrations. Waiting for migration lock to be cleared…
11-22 11:19:27 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
11-22 11:19:27 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
11-22 11:19:27 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
11-22 11:19:27 INFO metabase.db :: Migration lock is cleared. Running migrations…
11-22 11:19:28 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
11-22 11:19:28 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
11-22 11:19:28 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
Thu Nov 22 11:20:25 AST 2018 WARN: Caught while disconnecting…

EXCEPTION STACK TRACE:

** BEGIN NESTED EXCEPTION **

javax.net.ssl.SSLException
MESSAGE: closing inbound before receiving peer’s close_notify

STACKTRACE:

javax.net.ssl.SSLException: closing inbound before receiving peer’s close_notify
at java.base/sun.security.ssl.Alert.createSSLException(Alert.java:129)
at java.base/sun.security.ssl.Alert.createSSLException(Alert.java:117)
at java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:308)
at java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:264)
at java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:255)
at java.base/sun.security.ssl.SSLSocketImpl.shutdownInput(SSLSocketImpl.java:645)
at java.base/sun.security.ssl.SSLSocketImpl.shutdownInput(SSLSocketImpl.java:624)
at com.mysql.jdbc.MysqlIO.quit(MysqlIO.java:2246)
at com.mysql.jdbc.ConnectionImpl.realClose(ConnectionImpl.java:4236)
at com.mysql.jdbc.ConnectionImpl.close(ConnectionImpl.java:1462)
at clojure.java.jdbc$db_transaction_STAR_.invokeStatic(jdbc.clj:781)
at clojure.java.jdbc$db_transaction_STAR_.invoke(jdbc.clj:717)
at clojure.java.jdbc$db_transaction_STAR_.invokeStatic(jdbc.clj:730)
at clojure.java.jdbc$db_transaction_STAR_.invoke(jdbc.clj:717)
at metabase.db$migrate_BANG_.invokeStatic(db.clj:276)
at metabase.db$migrate_BANG_.invoke(db.clj:257)
at metabase.db$run_schema_migrations_BANG_$fn__15456.invoke(db.clj:435)
at metabase.util$do_with_auto_retries.invokeStatic(util.clj:411)
at metabase.util$do_with_auto_retries.invoke(util.clj:402)
at metabase.db$run_schema_migrations_BANG_.invokeStatic(db.clj:434)
at metabase.db$run_schema_migrations_BANG_.invoke(db.clj:417)
at metabase.db$setup_db_BANG_.invokeStatic(db.clj:453)
at metabase.db$setup_db_BANG_.doInvoke(db.clj:446)
at clojure.lang.RestFn.invoke(RestFn.java:397)
at metabase.cmd.load_from_h2$load_from_h2_BANG_.invokeStatic(load_from_h2.clj:215)
at metabase.cmd.load_from_h2$load_from_h2_BANG_.invoke(load_from_h2.clj:209)
at clojure.lang.Var.invoke(Var.java:381)
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:657)
at clojure.core$apply.invoke(core.clj:652)
at metabase.cmd$run_cmd$fn__56205.invoke(cmd.clj:133)
at metabase.cmd$run_cmd.invokeStatic(cmd.clj:133)
at metabase.cmd$run_cmd.invoke(cmd.clj:129)
at clojure.lang.Var.invoke(Var.java:385)
at metabase.core$run_cmd.invokeStatic(core.clj:256)
at metabase.core$run_cmd.invoke(core.clj:254)
at metabase.core$_main.invokeStatic(core.clj:265)
at metabase.core$_main.doInvoke(core.clj:261)
at clojure.lang.RestFn.applyTo(RestFn.java:137)
at metabase.core.main(Unknown Source)

** END NESTED EXCEPTION **

11-22 11:20:25 INFO metabase.db :: Database Migrations Current … :white_check_mark:
Thu Nov 22 11:20:25 AST 2018 WARN: Establishing SSL connection without server’s identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn’t set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to ‘false’. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.
Temporarily disabling DB constraints…
[OK]
Transfering 3 instances of Database…[OK]
Transfering 42 instances of User…[OK]
Transfering 20 instances of Setting…[OK]
Transfering 872 instances of Table…[OK]
Transfering 8372 instances of Field…[OK]
Transfering 6213 instances of FieldValues…[OK]
Transfering 1055 instances of Revision…[OK]
Transfering 17398 instances of ViewLog…[OK]
Transfering 67 instances of Session…[OK]
Transfering 40 instances of Dashboard…[OK]
Transfering 195 instances of Card…[OK]
Transfering 181 instances of DashboardCard…[OK]
Transfering 1 instances of DashboardCardSeries…[OK]
Transfering 1115 instances of Activity…[OK]
Transfering 21 instances of PermissionsGroup…[OK]
Transfering 102 instances of PermissionsGroupMembership…[OK]
Transfering 108 instances of Permissions…[OK]
Transfering 10 instances of PermissionsRevision…[OK]
Transfering 64 instances of Collection…[OK]
Transfering 31 instances of CollectionRevision…[OK]
Thu Nov 22 11:20:33 AST 2018 WARN: Caught while disconnecting…

EXCEPTION STACK TRACE:

** BEGIN NESTED EXCEPTION **

javax.net.ssl.SSLException
MESSAGE: closing inbound before receiving peer’s close_notify

STACKTRACE:

javax.net.ssl.SSLException: closing inbound before receiving peer’s close_notify
at java.base/sun.security.ssl.Alert.createSSLException(Alert.java:129)
at java.base/sun.security.ssl.Alert.createSSLException(Alert.java:117)
at java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:308)
at java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:264)
at java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:255)
at java.base/sun.security.ssl.SSLSocketImpl.shutdownInput(SSLSocketImpl.java:645)
at java.base/sun.security.ssl.SSLSocketImpl.shutdownInput(SSLSocketImpl.java:624)
at com.mysql.jdbc.MysqlIO.quit(MysqlIO.java:2246)
at com.mysql.jdbc.ConnectionImpl.realClose(ConnectionImpl.java:4236)
at com.mysql.jdbc.ConnectionImpl.close(ConnectionImpl.java:1462)
at clojure.java.jdbc$db_transaction_STAR_.invokeStatic(jdbc.clj:781)
at clojure.java.jdbc$db_transaction_STAR_.invoke(jdbc.clj:717)
at clojure.java.jdbc$db_transaction_STAR_.invokeStatic(jdbc.clj:730)
at clojure.java.jdbc$db_transaction_STAR_.invoke(jdbc.clj:717)
at metabase.cmd.load_from_h2$load_from_h2_BANG_.invokeStatic(load_from_h2.clj:216)
at metabase.cmd.load_from_h2$load_from_h2_BANG_.invoke(load_from_h2.clj:209)
at clojure.lang.Var.invoke(Var.java:381)
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:657)
at clojure.core$apply.invoke(core.clj:652)
at metabase.cmd$run_cmd$fn__56205.invoke(cmd.clj:133)
at metabase.cmd$run_cmd.invokeStatic(cmd.clj:133)
at metabase.cmd$run_cmd.invoke(cmd.clj:129)
at clojure.lang.Var.invoke(Var.java:385)
at metabase.core$run_cmd.invokeStatic(core.clj:256)
at metabase.core$run_cmd.invoke(core.clj:254)
at metabase.core$_main.invokeStatic(core.clj:265)
at metabase.core$_main.doInvoke(core.clj:261)
at clojure.lang.RestFn.applyTo(RestFn.java:137)
at metabase.core.main(Unknown Source)

** END NESTED EXCEPTION **

org.h2.jdbc.JdbcSQLException: Table “TASK_HISTORY” not found; SQL statement:
SELECT * FROM task_history [42102-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.command.Parser.readTableOrView(Parser.java:5920)
at org.h2.command.Parser.readTableFilter(Parser.java:1430)
at org.h2.command.Parser.parseSelectSimpleFromPart(Parser.java:2138)
at org.h2.command.Parser.parseSelectSimple(Parser.java:2287)
at org.h2.command.Parser.parseSelectSub(Parser.java:2133)
at org.h2.command.Parser.parseSelectUnion(Parser.java:1946)
at org.h2.command.Parser.parseSelect(Parser.java:1919)
at org.h2.command.Parser.parsePrepared(Parser.java:463)
at org.h2.command.Parser.parse(Parser.java:335)
at org.h2.command.Parser.parse(Parser.java:307)
at org.h2.command.Parser.prepareCommand(Parser.java:278)
at org.h2.engine.Session.prepareLocal(Session.java:611)
at org.h2.engine.Session.prepareCommand(Session.java:549)
at org.h2.jdbc.JdbcConnection.prepareCommand(JdbcConnection.java:1247)
at org.h2.jdbc.JdbcPreparedStatement.(JdbcPreparedStatement.java:76)
at org.h2.jdbc.JdbcConnection.prepareStatement(JdbcConnection.java:304)
at clojure.java.jdbc$prepare_statement.invokeStatic(jdbc.clj:620)
at clojure.java.jdbc$prepare_statement.invoke(jdbc.clj:567)
at clojure.java.jdbc$db_query_with_resultset_STAR_.invokeStatic(jdbc.clj:1017)
at clojure.java.jdbc$db_query_with_resultset_STAR_.invoke(jdbc.clj:1005)
at clojure.java.jdbc$query.invokeStatic(jdbc.clj:1099)
at clojure.java.jdbc$query.invoke(jdbc.clj:1056)
at clojure.java.jdbc$query.invokeStatic(jdbc.clj:1072)
at clojure.java.jdbc$query.invoke(jdbc.clj:1056)
at metabase.cmd.load_from_h2$load_data_BANG_.invokeStatic(load_from_h2.clj:141)
at metabase.cmd.load_from_h2$load_data_BANG_.invoke(load_from_h2.clj:138)
at metabase.cmd.load_from_h2$load_from_h2_BANG_$fn__56135.invoke(load_from_h2.clj:219)
at clojure.java.jdbc$db_transaction_STAR_.invokeStatic(jdbc.clj:747)
at clojure.java.jdbc$db_transaction_STAR_.invoke(jdbc.clj:717)
at clojure.java.jdbc$db_transaction_STAR_.invokeStatic(jdbc.clj:782)
at clojure.java.jdbc$db_transaction_STAR_.invoke(jdbc.clj:717)
at clojure.java.jdbc$db_transaction_STAR_.invokeStatic(jdbc.clj:730)
at clojure.java.jdbc$db_transaction_STAR_.invoke(jdbc.clj:717)
at metabase.cmd.load_from_h2$load_from_h2_BANG_.invokeStatic(load_from_h2.clj:216)
at metabase.cmd.load_from_h2$load_from_h2_BANG_.invoke(load_from_h2.clj:209)
at clojure.lang.Var.invoke(Var.java:381)
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:657)
at clojure.core$apply.invoke(core.clj:652)
at metabase.cmd$run_cmd$fn__56205.invoke(cmd.clj:133)
at metabase.cmd$run_cmd.invokeStatic(cmd.clj:133)
at metabase.cmd$run_cmd.invoke(cmd.clj:129)
at clojure.lang.Var.invoke(Var.java:385)
at metabase.core$run_cmd.invokeStatic(core.clj:256)
at metabase.core$run_cmd.invoke(core.clj:254)
at metabase.core$_main.invokeStatic(core.clj:265)
at metabase.core$_main.doInvoke(core.clj:261)
at clojure.lang.RestFn.applyTo(RestFn.java:137)
at metabase.core.main(Unknown Source)
Command failed with exception: Table “TASK_HISTORY” not found; SQL statement:
SELECT * FROM task_history [42102-197]
Metabase started.

#!/bin/bash
export MB_PASSWORD_COMPLEXITY=normal
export MB_PASSWORD_LENGTH=10
export MB_JETTY_HOST=0.0.0.0
export MB_JETTY_PORT=80
export MB_DB_TYPE=mysql
export MB_DB_DBNAME=
export MB_DB_PORT=3306
export MB_DB_USER=
export MB_DB_PASS=
export MB_DB_HOST=localhost
export MB_EMOJI_IN_LOGS=true
export MB_DB_AUTOMIGRATE=false
java -jar /usr/share/metabase/metabase.jar load-from-h2 /var/lib/docker/overlay2/82e1ebf2f86fbe082da93392585f45aea5b7d3913f30b51f632995a3db8c0d99/diff/metabase.db/metabase.db

whatever other env vars you want available

Have you got it working? I want to eventually make that very same migration, and your knowledge might be of great use.

@lucas.lima
The error Command failed with exception: Table "TASK_HISTORY" not found; SQL statement usually comes from trying to upgrade and migrate at the same time.
First upgrade, while still using H2 and then migrate.

1 Like