No "current" schema in flyway.url causes a Flyway exception
See original GitHub issueUsing 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:
- Created 10 years ago
- Comments:22 (4 by maintainers)
Top GitHub Comments
@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
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
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, whileflyway.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?