我覆盖了Mysql testcontainer
public class TestMySQLContainer extends MySQLContainer {
public TestMySQLContainer(String dockerImageName) {
super(dockerImageName);
withCommand("--default-authentication-plugin=mysql_native_password");
// withCommand("--log-bin-trust-routine-creators");
}
@Override
public String getDriverClassName() {
return "com.mysql.cj.jdbc.Driver";
}
}
使用Mysql 8.0.14 并拥有这样的脚本
drop trigger if exists environments_insert;
delimiter //
create trigger environments_insert
before insert
on console.environments
for each row
begin
if new.version_update_date is null then
set new.version_update_date = new.created;
end if;
end //
delimiter ;
与飞行通道配合正常
但是当我尝试使用MysqlContainer运行它时,我会出错
Statement : create trigger environments_insert
before insert
on console.environments
for each row
begin
if new.version_update_date is null then
set new.version_update_date = new.created;
end if;
end
at org.flywaydb.core.internal.sqlscript.DefaultSqlScriptExecutor.handleException(DefaultSqlScriptExecutor.java:268)
at org.flywaydb.core.internal.sqlscript.DefaultSqlScriptExecutor.executeStatement(DefaultSqlScriptExecutor.java:215)
at org.flywaydb.core.internal.sqlscript.DefaultSqlScriptExecutor.execute(DefaultSqlScriptExecutor.java:122)
at org.flywaydb.core.internal.resolver.sql.SqlMigrationExecutor.execute(SqlMigrationExecutor.java:77)
at org.flywaydb.core.internal.command.DbMigrate.doMigrateGroup(DbMigrate.java:367)
... 32 more
Caused by: java.sql.SQLException: You do not have the SUPER privilege and binary logging is enabled (you *might* want to use the less safe log_bin_trust_function_creators variable)
我该如何解决这个问题?