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

Azure MySQL database version incorrectly detected (5.6 instead of 5.7) #2519

Closed
antoniomateo opened this issue Sep 26, 2019 · 25 comments
Closed

Azure MySQL database version incorrectly detected (5.6 instead of 5.7) #2519

antoniomateo opened this issue Sep 26, 2019 · 25 comments

Comments

@antoniomateo
Copy link

@antoniomateo antoniomateo commented Sep 26, 2019

Which version and edition of Flyway are you using?

6.0.4 - Community edition

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)

Maven plugin

Which database are you using (type & version)?

Azure MySQL 5.7, not 5.6 as the error says. See this note in Azure:

NOTE: In the service, a gateway is used to redirect the connections to server instances. After the connection is established, the MySQL client displays the version of MySQL set in the gateway, not the actual version running on your MySQL server instance. To determine the version of your MySQL server instance, use the SELECT VERSION(); command at the MySQL prompt.

Extracted from: https://docs.microsoft.com/en-us/azure/mysql/concepts-supported-versions

Which operating system are you using?

Ubuntu:latest

What did you do?

(Please include the content causing the issue, any relevant configuration settings, the SQL statement that failed (if relevant) and the command you ran.)

Ran the flyway maven plugin to migrate an Azure database for the first time:
goals: 'flyway:migrate'

What did you expect to see?

The database tables created.

What did you see instead?

[ERROR] Failed to execute goal org.flywaydb:flyway-maven-plugin:6.0.4:migrate (default-cli) on project initializer: org.flywaydb.core.internal.license.FlywayEditionUpgradeRequiredException: Flyway Enterprise Edition or MySQL upgrade required: MySQL 5.6 is no longer supported by Flyway Community Edition, but still supported by Flyway Enterprise Edition. -> [Help 1]

@MikielAgutu
Copy link
Contributor

@MikielAgutu MikielAgutu commented Sep 26, 2019

Looks like this is a bug within the MySQL Azure service itself:

MySQL server instance displays the wrong server version after connection is established. To get the correct server instance engine version, use the select version(); command.

I don't think we can do anything about it unfortunately. We'll have to wait for Microsoft to fix the issue on their end.

@juliahayward
Copy link
Member

@juliahayward juliahayward commented Oct 4, 2019

Actually, I have a workround. Reopening...

@antoniomateo
Copy link
Author

@antoniomateo antoniomateo commented Oct 4, 2019

Hi Julia. Great, that's good news. Could you explain the workaround please? I mean, is that something we can already apply or need to wait for a new flyway release? Thanks in advance.

@juliahayward
Copy link
Member

@juliahayward juliahayward commented Oct 7, 2019

Essentially we can spot the case where the JDBC metadata and result of select version(); return conflicting information, and in that case assume that the latter is correct - at least until such time as Azure is confirmed fixed. I hope to get it into 6.0.5 which should happen early this week.

@alextercete alextercete removed this from the Flyway 6.1.0 milestone Oct 8, 2019
@alextercete alextercete added this to the Flyway 6.0.5 milestone Oct 8, 2019
MikielAgutu pushed a commit that referenced this issue Oct 8, 2019
@Matonen
Copy link

@Matonen Matonen commented Oct 15, 2019

Trying to migrate using Flyway Community Edition 6.0.6 by Redgate but i get following error:

WARNING: Azure MySQL database - reporting v5.6 in JDBC metadata but database actually v5.7.26-log
ERROR: Version may only contain 0..9 and . (dot). Invalid version: 5.7.26-log

@juliahayward juliahayward reopened this Oct 15, 2019
@juliahayward
Copy link
Member

@juliahayward juliahayward commented Oct 16, 2019

@Matonen I couldn't reproduce this odd result (5.7.26-log) from select version() on our Azure subscription. Is there anything out of the ordinary you need to do to see it? It doesn't stop me doing a fix, but it would be helpful to understand the context and anticipate any other unusual responses.

@juliahayward juliahayward removed this from the Flyway 6.0.6 milestone Oct 16, 2019
@juliahayward juliahayward added this to the Flyway 6.0.7 milestone Oct 16, 2019
@Matonen
Copy link

@Matonen Matonen commented Oct 17, 2019

I also run select version() using the MySQL Workbench and it returns 5.7.26-log. MySQL server tier is Basic and version is 5.7. Server is created to WestEurope.

@stevenenen
Copy link

@stevenenen stevenenen commented Oct 17, 2019

I have the exact same issue, but I just found out that it's because of the Basic 5.7 version. Try to create a General Purpose, 2 vCore(s), 100 GB and then it works for now.

@juliahayward
Copy link
Member

@juliahayward juliahayward commented Oct 17, 2019

Many thanks - I've reproduced it now. A fix on the way for 6.0.7.

@tygern
Copy link

@tygern tygern commented Dec 10, 2019

I'm still seeing this issue using MySQL 8.0 in Azure and version 6.1.1 of the Flyway gradle plugin.

@stevenenen
Copy link

@stevenenen stevenenen commented Dec 11, 2019

I also still have this issue when using a Basic 5.7 tier. It only works for me with a General Purpose, 2 vCore(s), 100 GB.

@juliahayward juliahayward reopened this Dec 11, 2019
@juliahayward
Copy link
Member

@juliahayward juliahayward commented Dec 11, 2019

@tygern @stevenenen Would you be able to run SELECT VERSION() on your dbs and let me know what the results are?

@juliahayward
Copy link
Member

@juliahayward juliahayward commented Dec 11, 2019

@tygern I've got a repro for you, a fix will go in v6.1.2. @stevenenen No joy when I create a Basic 5.7 db... could you also send me the output of flyway info -X please (do redact any database names, credentials, etc.)?

@juliahayward juliahayward removed this from the Flyway 6.0.7 milestone Dec 11, 2019
@juliahayward juliahayward added this to the Flyway 6.1.2 milestone Dec 11, 2019
@tygern
Copy link

@tygern tygern commented Dec 11, 2019

@juliahayward Great, thanks. Just to answer your question, I saw 8.1.0 when I ran SELECT VERSION() on my db on Azure.

dohrayme pushed a commit to dohrayme/flyway that referenced this issue Feb 3, 2020
dohrayme pushed a commit to dohrayme/flyway that referenced this issue Feb 3, 2020
dohrayme pushed a commit to dohrayme/flyway that referenced this issue Feb 3, 2020
@juliahayward
Copy link
Member

@juliahayward juliahayward commented May 4, 2020

Hi Ash, as mentioned in the SO post the underlying problem is that you migration is invalid for the version of MySQL you're using.

I see in your Stack Overflow post that you are using Flyway 5.2.4. There were a number of fixes around MySQL versioning in v6 a while back and we recommend you upgrade as far forward as possible.

@juliahayward juliahayward reopened this May 4, 2020
@brent777
Copy link

@brent777 brent777 commented Jul 16, 2020

I am using Flyway with a Kotlin / Micronaut application and I am still running into this same issue with an Azure MySQL 8 database. My Flyway version, etc:

16:16:42.946 [main] INFO o.f.c.i.license.VersionPrinter - Flyway Community Edition 6.4.4 by Redgate
16:16:43.257 [main] INFO o.f.c.i.database.DatabaseFactory - Database: jdbc:mysql://xxx (MySQL 5.6)

I have confirmed that the database is MySQL 8. Also I have confirmed that when connecting to a local MySQL 8 database, as opposed to one on Azure, I get the correct version coming through in the second info log statement above.

I believe this issue was fixed prior to version 6.4.4, any idea why I am still running into it given that I am running version 6.4.4?

@juliahayward
Copy link
Member

@juliahayward juliahayward commented Jul 20, 2020

@brent777 What is the exact output of select version() on this database please? Also, could you forward the results of flyway info -X (that is, full debug)? If you don't want to post here then send by email to julia.hayward@red-gate.com

@juliahayward juliahayward reopened this Jul 20, 2020
@juliahayward
Copy link
Member

@juliahayward juliahayward commented Oct 1, 2020

@brent777 Any news?

@juliahayward
Copy link
Member

@juliahayward juliahayward commented Oct 29, 2020

Revisited it with the current version (v8.0.15). The correct string comes through from MySQL SELECT VERSION() and Flyway identified the database as v8.0. In the absence of more feedback, closing. (as possibly an Azure MySQL problem that has been fixed)

@pschwager
Copy link

@pschwager pschwager commented Nov 18, 2020

@juliahayward I just tested it with MySQL 8.0.15 on Azure and flyway still detects it as 5.x. Are you sure that you aren't parsing something from the welcome header? (which reports a 5.6 instead of the 8.0)

Your MySQL connection id is 64864
Server version: 5.6.47.0 Source distribution

Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> select version();
+-----------+
| version() |
+-----------+
| 8.0.15    |
+-----------+
1 row in set (0.00 sec)

@DoodleBobBuffPants
Copy link
Contributor

@DoodleBobBuffPants DoodleBobBuffPants commented Nov 19, 2020

@pschwager Do you still get the no longer supported by Flyway Community Edition exception? It should still succeed and only be printing the (incorrect) version returned by the metadata

@juliahayward
Copy link
Member

@juliahayward juliahayward commented Nov 19, 2020

@pschwager We certainly don't parse the header, although it is quite possible the JDBC driver does under the hood (which would explain the consistent problems with incorrect JDBC metadata we have to work around). Could you confirm the versions of Flyway and the JDBC driver you're using?

@pschwager
Copy link

@pschwager pschwager commented Nov 19, 2020

OK, after a long search through the code, I found a property which sets the org.hibernate.dialect.MySQL57Dialect. After that was removed flyway also wasn't failing. So my issue is also fixed. Sorry for the tumult...

@juliahayward
Copy link
Member

@juliahayward juliahayward commented Nov 19, 2020

Thanks for letting us know! It's really helpful for us as we weren't aware of that property - it might help out some of the other people on the thread.

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