您如何迁移 Mirthconnect 以使用 MySQL/MariaDB
How do you migrate Mirthconnect to use MySQL/MariaDB
当尝试连接 mirthconnect 以使用 mariaDB 而不是 Derby 嵌入式数据库时,mirth connect 在创建数据库时失败。
使用:
- Ubuntu 18.04 LTS
- MariaDB 10.1.29-MariaDB-6
- 欢乐连线 3.6.0
- Java openjdk 10.0.1
设置步骤:
- 安装 Maria DB
- 安装 Mirth 连接。
- 创建用于 Mirth 的数据库
- 在 Maria DB 中创建 mirth 用户
- 配置 mirth 连接以连接到 Maria DB
- 开始欢乐服务
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 |
+------------------------+
谁能告诉我:
- 异常意味着什么?
- 如何解决错误?
有问题的错误
Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Specified key was too long; max key length is 767 bytes
似乎与密钥长度有关 - 数据库默认字符集是 utf16 而不是 utf8,因此由于字符大小(以字节为单位),其中一个表的密钥大小实际上大于 767 字节。
为 mirth 创建数据库时 - 确保字符集设置为 UTF8
create database mirthconnect character set utf8 collate utf8_general_ci;
当尝试连接 mirthconnect 以使用 mariaDB 而不是 Derby 嵌入式数据库时,mirth connect 在创建数据库时失败。
使用:
- Ubuntu 18.04 LTS
- MariaDB 10.1.29-MariaDB-6
- 欢乐连线 3.6.0
- Java openjdk 10.0.1
设置步骤:
- 安装 Maria DB
- 安装 Mirth 连接。
- 创建用于 Mirth 的数据库
- 在 Maria DB 中创建 mirth 用户
- 配置 mirth 连接以连接到 Maria DB
- 开始欢乐服务
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 |
+------------------------+
谁能告诉我:
- 异常意味着什么?
- 如何解决错误?
有问题的错误
Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Specified key was too long; max key length is 767 bytes
似乎与密钥长度有关 - 数据库默认字符集是 utf16 而不是 utf8,因此由于字符大小(以字节为单位),其中一个表的密钥大小实际上大于 767 字节。
为 mirth 创建数据库时 - 确保字符集设置为 UTF8
create database mirthconnect character set utf8 collate utf8_general_ci;