Error: select * from `strapi_database_schema` order by `time` DESC limit 1 - Out of sort memory, consider increasing server sort buffer size
### Node Version

v18.19.1

### NPM/Yarn/PNPM Version

Yarn 4.1.1

### Strapi Version

5.8.1

### Operating System

Docker/Podman/LXC

### Database

MySQL

### Javascript or Typescript

Typescript

### Reproduction URL

_No response_

### Bug Description

1、After upgrade strapi from v4 to v5
2、Run strapi with 200+ Content-Types， will throw errors:

![Image](https://github.com/user-attachments/assets/4f138b61-7f67-4891-a8da-8558006da077)

### Steps to Reproduce

1. npx @strapi/upgrade minor
2. npx @strapi/upgrade major
3. upgrade mysql verison to 5.8
4. yarn develop 

### Expected Behavior

The strapi is working.

### Logs

```shell

```

### Code Snippets

_No response_

### Media

_No response_

### Additional information

_No response_

### Confirmation Checklist

- [x] I have checked the existing [issues](https://github.com/strapi/strapi/issues) for duplicates.
- [x] I agree to follow this project's [Code of Conduct](https://github.com/strapi/strapi/blob/develop/CODE_OF_CONDUCT.md).