Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unsupported Database: MySQL 8.0 #3885

Closed
vifeng opened this issue Apr 29, 2024 · 2 comments
Closed

Unsupported Database: MySQL 8.0 #3885

vifeng opened this issue Apr 29, 2024 · 2 comments

Comments

@vifeng
Copy link

vifeng commented Apr 29, 2024

Which version and edition of Flyway are you using?

Flyway Community 8.2.1

If this is not the latest version, can you reproduce the issue with the latest one as well? (Many bugs are fixed in newer releases and upgrading will often resolve the issue)
Which client are you using? (Command-line, Java API, Maven plugin, Gradle plugin)

Gradle Version: 8.2.1 plugin
and
Flyway OSS Edition 10.11.1 by Redgate in command line

Which database are you using? (Type & version)

Mysql on google cloud sql MySQL 8.0.31

Which operating system are you using?

Mac, later i will be using docker with linux

What did you do?

I'm a beguinner working on my own, thank you for your comprehension and being very clear.
I was on h2 and migrated to gcp mysql. I had trouble with the no database found error when running flyway clean or gradle flywayClean it has been corrected and is running ok (thanks to issue 3722 and issue 3355). I also use a /Users/.../[project]/flyway.conf to connect to the database. Since this problem has been cleared I run gradle bootRun and it doesn't work.

build.gradle.kts

plugins {
id("java")
id("org.springframework.boot") version "3.2.5"
id("io.spring.dependency-management") version "1.1.4"
id("org.asciidoctor.jvm.convert") version "3.3.2"
id("com.diffplug.spotless") version "6.25.0"
id("org.flywaydb.flyway") version "10.11.1"
}
dependencyManagement {
imports {
mavenBom(org.springframework.boot.gradle.plugin.SpringBootPlugin.BOM_COORDINATES)
}
}
group = "com.vf"
version = "0.0.1-SNAPSHOT"
java {
sourceCompatibility = JavaVersion.VERSION_17
}
springBoot {
mainClass.set("com.vf.eventhubserver.EventhubServerApplication")
}
configurations {
compileOnly {
extendsFrom(configurations.annotationProcessor.get())
}
}
repositories {
mavenCentral()
maven {
url = uri("https://download.red-gate.com/maven/release")
}
}
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath("org.flywaydb:flyway-mysql:10.11.1")
}
}
val snippetsDir by extra { file("build/generated-snippets") }
val asciidoctorExt by configurations.creating
dependencies {
implementation(platform("com.google.cloud:spring-cloud-gcp-dependencies:4.1.4"))
implementation("com.google.cloud:spring-cloud-gcp-starter-sql-mysql")
implementation("com.google.cloud:google-cloud-secretmanager")
implementation ("mysql:mysql-connector-java:8.0.31")
implementation("org.flywaydb:flyway-core:10.11.1")
implementation ("com.google.code.findbugs:jsr305:3.0.2")
implementation("org.springframework.data:spring-data-rest-hal-explorer")
asciidoctorExt("org.springframework.restdocs:spring-restdocs-asciidoctor")
implementation("org.springframework.boot:spring-boot-starter-actuator")
implementation("org.springframework.boot:spring-boot-starter-data-jpa")
implementation("org.springframework.boot:spring-boot-starter-validation")
implementation("org.springframework.boot:spring-boot-starter-web")
implementation("org.springframework.boot:spring-boot-starter-webflux")
implementation("org.springframework.session:spring-session-core")
implementation ("org.mapstruct:mapstruct:1.5.5.Final")
annotationProcessor ("org.mapstruct:mapstruct-processor:1.5.5.Final")
implementation("org.springframework.boot:spring-boot-devtools")
// runtimeOnly("com.h2database:h2")
testImplementation("org.springframework.boot:spring-boot-starter-test")
testImplementation("io.projectreactor:reactor-test")
testImplementation("org.springframework.restdocs:spring-restdocs-mockmvc")
testAnnotationProcessor("org.mapstruct:mapstruct-processor:1.5.5.Final")
}
spotless {
java {
target("src/**/*.java")
googleJavaFormat()
removeUnusedImports()
}
}
asciidoctorj {
fatalWarnings(listOf(missingIncludes()))
}
tasks.withType().configureEach{
options.encoding = "UTF-8"
}
tasks.withType().configureEach{
options.encoding = "UTF-8"
}
tasks.test {
systemProperty("file.encoding", "UTF-8")
useJUnitPlatform()
outputs.dir(snippetsDir)
}
tasks.asciidoctor {
inputs.dir(snippetsDir)
configurations(listOf(asciidoctorExt))
dependsOn("test")
attributes(mapOf("snippets" to snippetsDir))
outputOptions{
backends ("html5")
}
options(mapOf("doctype" to "book"))
}
tasks.jar {
dependsOn("asciidoctor")
from ("${snippetsDir}/html5") {
into ("static/docs")
}
}
// A custom task to delete all the files and folders generated by Gradle
tasks.register("clearAll") {
delete("bin")
delete (".classpath")
delete (".gradle")
delete (".nb-gradle")
delete (".project")
delete (".settings")
// delete (".vscode")
delete (".DS_Store")
delete (".idea")
dependsOn(tasks.clean)
}
What did you expect to see?

I expected gradle bootRun to work as before (just well!).

What did you see instead? And what is your understanding of the situation:

I understand my connector and core versions are not compatible. But the doc says it's ok for 8.0 I that's what i have. I have tried several version without any luck. So what version should I use and above all, where/how do I find this info ? I really looked into your doc, nothing (same for the buildscript by the way.) I also looked into maven central i haven't find anything about compatibility. I would very much appreciate your answer so I would know for the futur.

error trace :

Application run failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'flywayInitializer' defined in class path resource [org/springframework/boot/autoconfigure/flyway/FlywayAutoConfiguration$FlywayConfiguration.class]: Unsupported Database: MySQL 8.0
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1786) ~[spring-beans-6.1.6.jar:6.1.6]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:600) ~[spring-beans-6.1.6.jar:6.1.6]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:522) ~[spring-beans-6.1.6.jar:6.1.6]
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:326) ~[spring-beans-6.1.6.jar:6.1.6]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-6.1.6.jar:6.1.6]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:324) ~[spring-beans-6.1.6.jar:6.1.6]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:200) ~[spring-beans-6.1.6.jar:6.1.6]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:313) ~[spring-beans-6.1.6.jar:6.1.6]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:200) ~[spring-beans-6.1.6.jar:6.1.6]
at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1234) ~[spring-context-6.1.6.jar:6.1.6]
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:952) ~[spring-context-6.1.6.jar:6.1.6]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:624) ~[spring-context-6.1.6.jar:6.1.6]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:146) ~[spring-boot-3.2.5.jar:3.2.5]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:754) ~[spring-boot-3.2.5.jar:3.2.5]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:456) ~[spring-boot-3.2.5.jar:3.2.5]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:334) ~[spring-boot-3.2.5.jar:3.2.5]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1354) ~[spring-boot-3.2.5.jar:3.2.5]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1343) ~[spring-boot-3.2.5.jar:3.2.5]
at com.vf.eventhubserver.EventhubServerApplication.main(EventhubServerApplication.java:11) ~[main/:na]
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[na:na]
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]
at java.base/java.lang.reflect.Method.invoke(Method.java:568) ~[na:na]
at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:50) ~[spring-boot-devtools-3.2.5.jar:3.2.5]
Caused by: org.flywaydb.core.api.FlywayException: Unsupported Database: MySQL 8.0
at org.flywaydb.core.internal.database.DatabaseTypeRegister.lambda$getDatabaseTypeForConnection$7(DatabaseTypeRegister.java:122) ~[flyway-core-10.11.1.jar:na]
at java.base/java.util.Optional.orElseThrow(Optional.java:403) ~[na:na]
at org.flywaydb.core.internal.database.DatabaseTypeRegister.getDatabaseTypeForConnection(DatabaseTypeRegister.java:122) ~[flyway-core-10.11.1.jar:na]
at org.flywaydb.core.internal.jdbc.JdbcConnectionFactory.(JdbcConnectionFactory.java:77) ~[flyway-core-10.11.1.jar:na]
at org.flywaydb.core.FlywayExecutor.execute(FlywayExecutor.java:138) ~[flyway-core-10.11.1.jar:na]
at org.flywaydb.core.Flyway.migrate(Flyway.java:151) ~[flyway-core-10.11.1.jar:na]
at org.springframework.boot.autoconfigure.flyway.FlywayMigrationInitializer.afterPropertiesSet(FlywayMigrationInitializer.java:66) ~[spring-boot-autoconfigure-3.2.5.jar:3.2.5]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1833) ~[spring-beans-6.1.6.jar:6.1.6]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1782) ~[spring-beans-6.1.6.jar:6.1.6]
... 23 common frames omitted

I would gladly provide anything relevant other file or the build --scan

(this has been posted on your forum without luck yet)

@JasonLuo-Redgate
Copy link

Hi @vifeng ,
Based on https://documentation.red-gate.com/fd/mysql-184127601.html, could you check whether you included:

dependencies {
    implementation "com.redgate.flyway:flyway-mysql"
}

@vifeng
Copy link
Author

vifeng commented Aug 12, 2024

thank you I did try that (of course) but no chances there. Unfortunately my free trial google account is now finished so I can no longer test anything..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants