jamell.dev

Airflow 3 with MySQL 8.0 fails because Flask-AppBuilder uses CREATE INDEX IF NOT EXISTS

2026-03-04 (7m ago)7 views

#airflow#mysql#flask-appbuilder

I spent way too long on this. I was trying to run Airflow 3.1.7 on MySQL 8.0 and the database migration kept failing with a cryptic SQL error:

sqlalchemy.exc.ProgrammingError: (pymysql.err.ProgrammingError) (1064,
"You have an error in your SQL syntax ... near 'IF NOT EXISTS idx_group_id
ON ab_group_role (group_id)' at line 1")
[SQL: CREATE INDEX IF NOT EXISTS idx_group_id ON ab_group_role (group_id)]

Airflow's official docs say MySQL 8.0 is supported, so I assumed this was a configuration problem. It's not.

What's actually happening

Flask-AppBuilder (FAB) — the auth library that Airflow historically used for its web UI and user management — has alembic migrations that generate CREATE INDEX IF NOT EXISTS SQL. This syntax is supported by PostgreSQL and MariaDB but not by MySQL. MySQL has never added CREATE INDEX IF NOT EXISTS to its syntax. The migration crashes, Airflow's init containers timeout waiting for it, and everything crash-loops.

This isn't a version issue — MySQL 8.0, 8.1, 8.4 all have the same problem.

The fix: use SimpleAuthManager instead

In Airflow 3, FAB is no longer the default auth manager. Airflow 3 ships with SimpleAuthManager as the built-in default, which bypasses FAB entirely. No FAB tables, no CREATE INDEX IF NOT EXISTS, no migration failure.

The trick: if you're using the official Airflow Helm chart, it may default to FAB depending on which providers are installed. To explicitly skip FAB, set this in your Helm values:

# Don't set auth_manager explicitly -- Airflow 3's default IS SimpleAuthManager.
# If you set it explicitly in some chart versions, it fails to import.
# Just don't install apache-airflow-providers-fab and you're done.

If SimpleAuthManager is already the default and FAB isn't in your image, you don't need to set anything. The migrations will run clean on MySQL.

What SimpleAuthManager means for your setup

What still doesn't work

If you need FAB (RBAC, OAuth, SSO), you're stuck. The only MySQL-compatible options at the time of writing are:

For a POC environment: SimpleAuthManager is the right call.