Migration V22__add_user_session_token_index.sql failed

win029 2020-2-20 1786

按教程修改了:

1.修改wildfirechat.conf文件中的server.ip为服务器ip地址,embed.db 0,

2.修改c3p0-config.xml文件中的root口令,其它都没有修改。

win8系统+mysql5.7,同样的环境运行之前的0.27版执行没有问题。具体错误信息如图

D:\webserver\im-server-release038>bin\wildfirechat.bat

Using JAVA_HOME: "C:\Program Files\Java\jdk1.8.0_201"

Using WILDFIRECHAT_HOME: "D:\webserver\im-server-release038"

Exception in thread "main" org.flywaydb.core.internal.command.DbMigrate$FlywayMigrateException:

Migration V22__add_user_session_token_index.sql failed

SQL State : 42000 Error Code : 1071 Message : Specified key was too long; max key length is 767 bytes Location : .\migrate\mysql\V22add_user_session_token_index.sql (D:\webserver\im-server-release038.\migrate\mysql\V22add_user_session_token_index.sql) Line : 1 Statement : alter table t_user_session ADD INDEX session_token_index ( _token ) at org.flywaydb.core.internal.command.DbMigrate.doMigrateGroup(DbMigrate.java:370) at org.flywaydb.core.internal.command.DbMigrate.access$200(DbMigrate.java:54) at org.flywaydb.core.internal.command.DbMigrate$3.call(DbMigrate.java:284) at org.flywaydb.core.internal.jdbc.TransactionTemplate.execute(TransactionTemplate.java:74) at org.flywaydb.core.internal.command.DbMigrate.applyMigrations(DbMigrate.java:281) at org.flywaydb.core.internal.command.DbMigrate.migrateGroup(DbMigrate.java:246) at org.flywaydb.core.internal.command.DbMigrate.access$100(DbMigrate.java:54) at org.flywaydb.core.internal.command.DbMigrate$2.call(DbMigrate.java:164) at org.flywaydb.core.internal.command.DbMigrate$2.call(DbMigrate.java:161) at org.flywaydb.core.internal.database.mysql.MySQLNamedLockTemplate.execute(MySQLNamedLockTemplate.java:60) at org.flywaydb.core.internal.database.mysql.MySQLConnection.lock(MySQLConnection.java:147) at org.flywaydb.core.internal.schemahistory.JdbcTableSchemaHistory.lock(JdbcTableSchemaHistory.java:155) at org.flywaydb.core.internal.command.DbMigrate.migrateAll(DbMigrate.java:161) at org.flywaydb.core.internal.command.DbMigrate.migrate(DbMigrate.java:139) at org.flywaydb.core.Flyway$1.execute(Flyway.java:1395) at org.flywaydb.core.Flyway$1.execute(Flyway.java:1356) at org.flywaydb.core.Flyway.execute(Flyway.java:1711) at org.flywaydb.core.Flyway.migrate(Flyway.java:1356) at win.liyufan.im.DBUtil.init(DBUtil.java:103) at io.moquette.server.Server.startServer(Server.java:223) at io.moquette.server.Server.startServer(Server.java:215) at io.moquette.server.Server.startServer(Server.java:199) at io.moquette.server.Server.start(Server.java:109) at cn.wildfirechat.server.Server.main(Server.java:15) Caused by: org.flywaydb.core.internal.sqlscript.FlywaySqlScriptException:

Migration V22__add_user_session_token_index.sql failed

上传的附件:
最新回复 (5)
  • x86 2020-2-20
    引用 2
    你可以把你的 mysql升级一下,5.7.27没问题
  • win029 2020-2-20
    引用 3
    非常感谢x86,升级数据库到5.7.27后一切运行正常!
  • onlyxx 2020-11-3
    引用 4
    我在阿里云的RDS mysql 5.7.30上还是会有这个报错
    SQL State  : 42000
    Error Code : 1071
    Message    : Specified key was too long; max key length is 767 bytes
    Location   : ./migrate/mysql/V22__add_user_session_token_index.sql (/data/im/./migrate/mysql/V22__add_user_session_token_index.sql)
    Line       : 1
    Statement  : alter table `t_user_session` ADD INDEX `session_token_index` ( `_token` )

            at org.flywaydb.core.internal.sqlscript.DefaultSqlScriptExecutor.handleException(DefaultSqlScriptExecutor.java:253)
            at org.flywaydb.core.internal.sqlscript.DefaultSqlScriptExecutor.executeStatement(DefaultSqlScriptExecutor.java:202)
            at org.flywaydb.core.internal.sqlscript.DefaultSqlScriptExecutor.execute(DefaultSqlScriptExecutor.java:125)
            at org.flywaydb.core.internal.resolver.sql.SqlMigrationExecutor.execute(SqlMigrationExecutor.java:77)
            at org.flywaydb.core.internal.command.DbMigrate.doMigrateGroup(DbMigrate.java:367)
            ... 23 more
    Caused by: java.sql.SQLSyntaxErrorException: Specified key was too long; max key length is 767 bytes
  • onlyxx 2020-11-3
    引用 5
    初次启动会有上面的报错,再次启动就会提示
    Exception in thread "main" org.flywaydb.core.api.FlywayException: Validate failed: Detected failed migration to version 22 (add user session token index)
            at org.flywaydb.core.Flyway.doValidate(Flyway.java:1482)
            at org.flywaydb.core.Flyway.access$100(Flyway.java:85)
            at org.flywaydb.core.Flyway$1.execute(Flyway.java:1364)
            at org.flywaydb.core.Flyway$1.execute(Flyway.java:1356)
            at org.flywaydb.core.Flyway.execute(Flyway.java:1711)
            at org.flywaydb.core.Flyway.migrate(Flyway.java:1356)
            at win.liyufan.im.DBUtil.init(DBUtil.java:101)
            at io.moquette.server.Server.startServer(Server.java:228)
            at io.moquette.server.Server.startServer(Server.java:220)
            at io.moquette.server.Server.startServer(Server.java:204)
            at io.moquette.server.Server.start(Server.java:114)
            at cn.wildfirechat.server.Server.main(Server.java:15)

    启动失败了
  • HeavyRain 2020-11-3
    引用 6
    需要用到mysql5.7的最新版本,某个版本支持不支持长的key值,你们可以给阿里云提个工单问问怎么处理
返回