Reuse database

Metabase version: {:date 2021-08-26, :tag v0.40.3.1, :branch release-x.40.x, :hash 0550b86}
OS: Linux 5.4.0-72-generic amd64
Java version: Java HotSpot(TM) 64-Bit Server VM 16.0.1

online mysql: 5.7.30
local mysql: 5.7.23

I had an online environment database.

Run java -jar metabse after I dumped sql file from online database to my local mysql database.

metabase recreate table, so it occured error

I observed that the database found two more tables´╝îDATABASECHANGELOG and DATABASECHANGELOGLOCK

2021-09-06 11:11:15,420 INFO db.liquibase :: Database has unrun migrations. Waiting for migration lock to be cleared...
.....
2021-09-06 11:11:15,494 INFO db.liquibase :: Migration lock is cleared. Running migrations...
...

2021-09-06 11:11:15,584 ERROR changelog.ChangeSet :: Change Set migrations/000_migrations.yaml::1::agilliland failed. Error: (conn=408) Table 'core_organization' already exists [Failed SQL: CREATE TABLE metabase.core_organization (id INT AUTO_INCREMENT NOT NULL, slug VARCHAR(254) NOT NULL, name VARCHAR(254) NOT NULL, description TEXT NULL, logo_url VARCHAR(254) NULL, inherits BIT(1) NOT NULL, CONSTRAINT PK_CORE_ORGANIZATION PRIMARY KEY (id), UNIQUE (slug)) ENGINE InnoDB CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci]

2021-09-06 11:11:15,846 ERROR metabase.core :: Metabase Initialization FAILED
liquibase.exception.MigrationFailedException: Migration failed for change set migrations/000_migrations.yaml::1::agilliland:
Reason: liquibase.exception.DatabaseException: (conn=408) Table 'core_organization' already exists [Failed SQL: CREATE TABLE metabase.core_organization (id INT AUTO_INCREMENT NOT NULL, slug VARCHAR(254) NOT NULL, name VARCHAR(254) NOT NULL, description TEXT NULL, logo_url VARCHAR(254) NULL, inherits BIT(1) NOT NULL, CONSTRAINT PK_CORE_ORGANIZATION PRIMARY KEY (id), UNIQUE (slug)) ENGINE InnoDB CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci]
at liquibase.changelog.ChangeSet.execute(ChangeSet.java:637)
at liquibase.changelog.visitor.UpdateVisitor.visit(UpdateVisitor.java:53)
at liquibase.changelog.ChangeLogIterator.run(ChangeLogIterator.java:83)
at liquibase.Liquibase.update(Liquibase.java:202)
at liquibase.Liquibase.update(Liquibase.java:179)
at liquibase.Liquibase.update(Liquibase.java:175)
at metabase.db.liquibase$migrate_up_if_needed_BANG_$fn__35464.invoke(liquibase.clj:126)
at metabase.util$do_with_auto_retries.invokeStatic(util.clj:464)
at metabase.util$do_with_auto_retries.invoke(util.clj:456)
at metabase.util$do_with_auto_retries.invokeStatic(util.clj:471)
at metabase.util$do_with_auto_retries.invoke(util.clj:456)
at metabase.util$do_with_auto_retries.invokeStatic(util.clj:471)
at metabase.util$do_with_auto_retries.invoke(util.clj:456)
at metabase.util$do_with_auto_retries.invokeStatic(util.clj:471)
at metabase.util$do_with_auto_retries.invoke(util.clj:456)
at metabase.db.liquibase$migrate_up_if_needed_BANG_.invokeStatic(liquibase.clj:126)
at metabase.db.liquibase$migrate_up_if_needed_BANG_.invoke(liquibase.clj:114)
at metabase.db.setup$migrate_BANG_$fn__35692$fn__35693.invoke(setup.clj:68)
at metabase.db.liquibase$do_with_liquibase.invokeStatic(liquibase.clj:38)
at metabase.db.liquibase$do_with_liquibase.invoke(liquibase.clj:30)
at metabase.db.setup$migrate_BANG_$fn__35692.invoke(setup.clj:63)
at clojure.java.jdbc$db_transaction_STAR_.invokeStatic(jdbc.clj:807)
at clojure.java.jdbc$db_transaction_STAR_.invoke(jdbc.clj:776)
at clojure.java.jdbc$db_transaction_STAR_.invokeStatic(jdbc.clj:852)
at clojure.java.jdbc$db_transaction_STAR_.invoke(jdbc.clj:776)
at clojure.java.jdbc$db_transaction_STAR_.invokeStatic(jdbc.clj:789)
at clojure.java.jdbc$db_transaction_STAR_.invoke(jdbc.clj:776)
at metabase.db.setup$migrate_BANG_.invokeStatic(setup.clj:54)
at metabase.db.setup$migrate_BANG_.invoke(setup.clj:40)
at metabase.db.setup$run_schema_migrations_BANG_.invokeStatic(setup.clj:119)
at metabase.db.setup$run_schema_migrations_BANG_.invoke(setup.clj:115)
at metabase.db.setup$setup_db_BANG_$fn__35743$fn__35744.invoke(setup.clj:143)
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.db$setup_db_BANG_$fn__35757.invoke(db.clj:61)
at metabase.db$setup_db_BANG_.invokeStatic(db.clj:56)
at metabase.db$setup_db_BANG_.invoke(db.clj:51)
at metabase.core$init_BANG_.invokeStatic(core.clj:87)
at metabase.core$init_BANG_.invoke(core.clj:66)
at metabase.core$start_normally.invokeStatic(core.clj:131)
at metabase.core$start_normally.invoke(core.clj:125)
at metabase.core$_main.invokeStatic(core.clj:164)
at metabase.core$_main.doInvoke(core.clj:158)
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)

i found it different mysql attribute lower_case_table_names between two envirorment.
online mysql lower_case_table_names=1
local mysql lower_case_table_names=0

i changed lower_case_table_names 0 to 1 on my local mysql, it works.

1 Like