How to Use Flyway to Connect to TiDB

This topic has been translated from a Chinese forum by GPT and might contain errors.

Original topic: 如何使用flyway连接tidb

| username: TiDBer_cCPRnVrj

According to flyway issue #3343, flyway supports TiDB. How can this be achieved?

Currently, the product uses flyway and MySQL 8.0, but when switching to TiDB, flyway indicates it is MySQL 5.7. How does TiDB support MySQL 8.0? Or, how can flyway be made compatible/support TiDB? (Or is it that only lower versions of flyway support TiDB?)

[TiDB Usage Environment] Testing/Poc
[TiDB Version] tidb-community-server-v7.3.0-linux-amd64

[Reproduction Path] What operations were performed to encounter the issue

[Encountered Problem: Problem Phenomenon and Impact]
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘flywayInitializer’ defined in class path resource [org/springframework/boot/autoconfigure/flyway/FlywayAutoConfiguration$FlywayConfiguration.class]: Flyway Teams Edition or MySQL upgrade required: MySQL 5.7 is no longer supported by Flyway Community Edition, but still supported by Flyway Teams Edition.

[Resource Configuration] Enter TiDB Dashboard - Cluster Info - Hosts and take a screenshot of this page
[Attachments: Screenshots/Logs/Monitoring]

| username: 像风一样的男子 | Original post link

Currently, TiDB only supports MySQL 5.7, and the version compatible with 8.0 has not been released yet. According to the official Flyway documentation, it supports TiDB.

Flyway version and MySQL version correspondence

  • Flyway 6.x.x: Supports MySQL 5.5 and above
  • Flyway 7.x.x: Supports MySQL 5.6 and above
  • Flyway 8.x.x: Supports MySQL 5.7 and above
  • Flyway 8.2.x: Supports MySQL 8.0 and above
| username: Billmay表妹 | Original post link

You might need to consult the Flyway community.

| username: 像风一样的男子 | Original post link

The link to the Flyway official website regarding TiDB support.
TiDB (Titanium DB) - Flyway - Product Documentation (

| username: 裤衩儿飞上天 | Original post link

You can try changing the server version.

| username: 有猫万事足 | Original post link

If you just want to modify the return value of the version function to get past this issue, it’s not entirely impossible.

Changing this parameter will do. You can even set it to mysql9.0.


The value of `server-version` will be used by TiDB nodes to verify the current version of TiDB. Therefore, before upgrading the TiDB cluster, please set the `server-version` value to empty or the actual version of the current TiDB to avoid unexpected behavior.

But it’s not without cost. Pay attention to the above note.

So the best solution is still to go to the Flyway community for help.

| username: Fly-bird | Original post link

The TiDB port is 4000, don’t get it wrong.

| username: ajin0514 | Original post link

Only compatible with MySQL.

| username: TiDBer_cCPRnVrj | Original post link

Hmm, thank you, the port is correct.

| username: TiDBer_cCPRnVrj | Original post link

Well, I’ll give it a try, thanks for providing! But I think there might be issues with SQL execution.

| username: system | Original post link

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.