question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

No "current" schema in flyway.url causes a Flyway exception

See original GitHub issue

Using the Maven plugin, with a Mysql JDBC url containing no schema, Flyway migrates the database, but fails just after complaining with “Error setting current schema to ``: No database selected”.

Failing Jdbc url : jdbc:mysql://localhost:3306 Valid Jdbc url : jdbc:mysql://localhost:3306/myDatabase

This occurs even with some schemas specified (in the pom.xml),

Not reproduced with Flyway 2.1.1 (maven 3.0.5) Failing with Flyway plugin : 2.2.1 (maven 3.1) Driver : org.gjt.mm.mysql.Driver

It seems that this line in Flyway.java (https://github.com/flyway/flyway/blob/master/flyway-core/src/main/java/com/googlecode/flyway/core/Flyway.java#L875) assumes that dbSupport.getCurrentSchema() will return something meaningful but it returns an empty string the failing jdbc url.

Issue Analytics

  • State:closed
  • Created 10 years ago
  • Comments:22 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
treazcommented, Oct 7, 2015

@g0t4 @diogogmt I don’t think this is a flyway issue. login to mysql on the server with the user that flyway uses and then do: select count(*) form information_schema.events;

I bet that you’ll be getting a

ERROR 1577 (HY000): Cannot proceed because system tables used by Event Scheduler were found damaged at server start

Then you need to fix your mysql server (I haven’t found out how to do that yet). But there’s a couple of links out there

1reaction
mauromolcommented, Nov 13, 2017

I’m still having the “no database selected” problem with Flyway 4.2.0 and running Flyway through Gradle. The flyway.url is set without the schema name, while flyway.schemas is set to the correct schema name. This did not happen with Flyway 3.2.1.

I have to workaround this by putting the schema name in the URL, however I would prefer to avoid this. Any suggestion?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error Codes - Flyway by Redgate • Database Migrations Made ...
Caused by: The schema being validated against does not exist · Solution: Manually create the schema or enable createSchemas ...
Read more >
java - Spring Boot FlywayException: Unable to connect to the ...
Run With maven: Failed to execute goal org.flywaydb:flyway-maven-plugin:6.5.5:migrate (default-cli) on project myProject: ...
Read more >
Release Notes for Flyway Engine - Documentation
When urls are unsupported by check, ascertain which ones are unsupported, and include them as part of the exception. Database compatibility.
Read more >
85. Database Initialization - Spring
It defaults to create-drop if no schema manager has been detected or none in ... spring.flyway.url or spring.flyway.user is sufficient to cause Flyway...
Read more >
Release Notes - Flyway by Boxfuse • Database Migrations ...
Issue 966 Commandline: Deprecated jarDir , use jarDirs instead. Bug fixes. Issue 598 No "current" schema in flyway.url causes a Flyway exception; Issue...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found