当尝试连接mirthconnect以使用mariaDB而非Derby嵌入式DB时,创建数据库时mirth connect失败。
使用:
设置步骤:
http://www.hpctech.org/8-steps-to-install-mirthconnect-with-mysql-mariadb-on-linux/
启动mirthconnect服务时,将引发以下异常。
ERROR 2018-07-04 15:13:11,013 [Main Server Thread] com.mirth.connect.server.Mirth: Failed to migrate database schema
com.mirth.connect.model.util.MigrationException: Failed to execute script: /mysql/mysql-database.sql
at com.mirth.connect.server.migration.Migrator.executeScript(Migrator.java:103)
at com.mirth.connect.server.migration.Migrator.executeScript(Migrator.java:86)
at com.mirth.connect.server.migration.ServerMigrator.initDatabase(ServerMigrator.java:234)
at com.mirth.connect.server.migration.ServerMigrator.migrate(ServerMigrator.java:59)
at com.mirth.connect.server.controllers.DefaultMigrationController.migrate(DefaultMigrationController.java:91)
at com.mirth.connect.server.Mirth.startup(Mirth.java:226)
at com.mirth.connect.server.Mirth.run(Mirth.java:153)
Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Specified key was too long; max key length is 767 bytes
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:488)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:408)
at com.mysql.jdbc.Util.getInstance(Util.java:383)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1062)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4208)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4140)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2597)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2758)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2820)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2769)
at com.mysql.jdbc.StatementImpl.execute(StatementImpl.java:907)
at com.mysql.jdbc.StatementImpl.execute(StatementImpl.java:791)
at com.mirth.connect.server.migration.Migrator.executeScript(Migrator.java:100)
... 6 more
已经创建了一半的数据库表
show tables;
+------------------------+
| Tables_in_mirthconnect |
+------------------------+
| CHANNEL |
| EVENT |
| PERSON |
| PERSON_PASSWORD |
| PERSON_PREFERENCE |
| SCHEMA_INFO |
| SCRIPT |
+------------------------+
谁能告诉我:
答案 0 :(得分:2)
有问题的错误
Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Specified key was too long; max key length is 767 bytes
似乎与键长有关-数据库默认字符集是utf16而不是utf8,因此,由于字符的大小(以字节为单位),表之一的键大小实际上大于767字节。
在创建欢乐数据库时-确保将字符集设置为UTF8
create database mirthconnect character set utf8 collate utf8_general_ci;