Metabase Mysql schema Import Error

Hi I have created metabase with mysql db , it contains couple of dashboards with arround 20 questions each. I am getting an error migration the sql schema to new server. It giving duplicate primary key error. I think the error is happening on table query which uses 32 bit query_hash as primary key. I am using Mysql 5.7 on Azure with utf8mb4_unicode_ci;

Hi @babarali
If you’re migrating from one MySQL server to another, then it sounds like you’re not doing a proper dump/load of the data.
Please post “Diagnostic Info” from Admin > Troubleshooting.
And please post the full error.

Hi, Here is the diagnostic info .
“browser-info”: {
“language”: “en-US”,
“platform”: “Win32”,
“userAgent”: “Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36”,
“vendor”: “Google Inc.”
“system-info”: {
“”: “OpenJDK Runtime Environment”,
“java.runtime.version”: “11.0.5+10”,
“java.vendor”: “AdoptOpenJDK”,
“java.vendor.url”: “”,
“java.version”: “11.0.5”,
“”: “OpenJDK 64-Bit Server VM”,
“java.vm.version”: “11.0.5+10”,
“”: “Linux”,
“os.version”: “4.15.0-1071-azure”,
“user.language”: “en”,
“user.timezone”: “UTC”
“metabase-info”: {
“databases”: [
“hosting-env”: “unknown”,
“application-database”: “mysql”,
“application-database-details”: {
“database”: {
“name”: “MySQL”,
“version”: “”
“jdbc-driver”: {
“name”: “MariaDB Connector/J”,
“version”: “2.5.1”
“run-mode”: “prod”,
“version”: {
“date”: “2020-02-25”,
“tag”: “v0.34.3”,
“branch”: “release-0.34.x”,
“hash”: “1a83edb”
“settings”: {
“report-timezone”: null

And db migration error
Migration Error > Duplicate entry ‘\x00C\x16\xEF\xBF\xBDw\x1B\xEF\xBF\xBD\x0C\xEF\xBF\xBD)K\xEF\xBF’ for key ‘PRIMARY’ | | {“message”:“Duplicate entry ‘\x00C\x16\xEF\xBF\xBDw\x1B\xEF\xBF\xBD\x0C\xEF\xBF\xBD)K\xEF\xBF’ for key ‘PRIMARY’”,“stack”:“QueryFailedError: Duplicate entry ‘\x00C\x16\xEF\xBF\xBDw\x1B\xEF\xBF\xBD\x0C\xEF\xBF\xBD)K\xEF\xBF’ for key ‘PRIMARY’\n at new QueryFailedError (D:\OTOZ\METABASE-MIGRATIONS\metabase-migration-may2\reporting-metabase-migration\dev\src\error\QueryFailedError.ts:9:9)\n at Query.onResult (D:\OTOZ\METABASE-MIGRATIONS\metabase-migration-may2\reporting-metabase-migration\dev\src\driver\mysql\MysqlQueryRunner.ts:167:37)\n at Query.execute (D:\OTOZ\METABASE-MIGRATIONS\metabase-migration-may2\reporting-metabase-migration\dev\node_modules\mysql2\lib\commands\command.js:30:14)\n at PoolConnection.handlePacket (D:\OTOZ\METABASE-MIGRATIONS\metabase-migration-may2\reporting-metabase-migration\dev\node_modules\mysql2\lib\connection.js:417:32)\n at PacketParser.onPacket (D:\OTOZ\METABASE-MIGRATIONS\metabase-migration-may2\reporting-metabase-migration\dev\node_modules\mysql2\lib\connection.js:75:12)\n at PacketParser.executeStart (D:\OTOZ\METABASE-MIGRATIONS\metabase-migration-may2\reporting-metabase-migration\dev\node_modules\mysql2\lib\packet_parser.js:75:16)\n at TLSSocket. (D:\OTOZ\METABASE-MIGRATIONS\metabase-migration-may2\reporting-metabase-migration\dev\node_modules\mysql2\lib\connection.js:337:25)\n at TLSSocket.emit (events.js:311:20)\n at addChunk (_stream_readable.js:294:12)\n at readableAddChunk (_stream_readable.js:275:11)\n at TLSSocket.Readable.push (_stream_readable.js:209:10)\n at TLSWrap.onStreamRead (internal/stream_base_commons.js:186:23)”}

I am using typeorm to migrate db from node application. The script used to work fine with older version of metabase application data backup. After I have added some new queries It has statyed giving this error.

I have broken down the script and find out that the duplicate primary key error is happening in the part of script which created table query and inserts data into it.

@babarali I don’t know where you’re currently running Metabase, but it’s running on version, which doesn’t support utf8mb4, so that’s likely the problem.
Minimum version is 5.7.7:
Otherwise try with another tool - like the builtin mysqldump.