### Apache Airflow version

2.2.2 (latest released)

### Operating System

Debian GNU/Linux 10 (buster)

### Versions of Apache Airflow Providers

_No response_

### Deployment

Other 3rd-party Helm chart

### Deployment details

Using MySQL 8.0 via Google CloudSQL

### What happened

When upgrading from 2.1.2 to 2.2.2 the `airflow db upgrade` command failed with the following command:

```
sqlalchemy.exc.OperationalError: (MySQLdb._exceptions.OperationalError) (1786, 'Statement violates GTID consistency: CREATE TABLE ... SELECT.')
[SQL: create table _airflow_moved__2_2__task_instance as select source.* from task_instance as source
        left join dag_run as dr
        on (source.dag_id = dr.dag_id and source.execution_date = dr.execution_date)
        where dr.id is null
    ]
```

On further investigation, it looks like `CREATE TABLE AS SELECT ...` queries will cause GTID consistency violations whenever mySQL GTID-based replication is used ([source](https://dev.mysql.com/doc/refman/5.7/en/replication-gtids-restrictions.html)).

This is used by default on all Google CloudSQL mySQL instances, so they will always block these queries ([source](https://cloud.google.com/sql/docs/mysql/features#unsupported-statements))

It looks like these queries are created here:
https://github.com/apache/airflow/blob/eaa8ac72fc901de163b912a94dbe675045d2a009/airflow/utils/db.py#L739-L747

Could we refactor this into two separate queries like:
```python
 else: 
     # Postgres, MySQL and SQLite all have the same CREATE TABLE a AS SELECT ... syntax 
     session.execute( 
         text( 
             f"create table {target_table_name} like  {source_table}" 
         ) 
     ) 
      session.execute( 
         text( 
             f"INSERT INTO {target_table_name} select source.* from {source_table} as source " + where_clause 
         ) 
     ) 
 ```
 
 In order to preserve the GTID consistency?
 
### Are you willing to submit PR?

- [X] Yes I am willing to submit a PR!

### Code of Conduct

- [X] I agree to follow this project's [Code of Conduct](https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md)

airflow/utils/db.py
where_clause = """
        left join dag_run as dr
        on (source.dag_id = dr.dag_id and source.execution_date = dr.execution_date)
        where dr.id is null
    """
    _move_dangling_table(session, source_table, target_table_name, where_clause)
def check_task_tables_without_matching_dagruns(session) -> Iterable[str]: