Skip to main content
Unlisted page
This page is unlisted. Search engines will not index it, and only users having a direct link can access it.

MySQL 客户端仅支持 mysql2

🌐 Only the mysql2 package is supported for the MySQL client

Strapi 5 只能对 MySQL 数据库使用 mysql2 包,并且其 client 值必须设置为 mysql

🌐 Strapi 5 can only use the mysql2 package for MySQL databases, and the client value for it must be set to mysql.

此页面是重大更改数据库的一部分,提供关于重大更改的信息以及从 Strapi v4 迁移到 Strapi 5 的附加说明。

🌐 This page is part of the breaking changes database and provides information about the breaking change and additional instructions to migrate from Strapi v4 to Strapi 5.

 Is this breaking change affecting plugins?No
 Is this breaking change automatically handled by a codemod?Yes

重大变更描述

🌐 Breaking change description

在 Strapi v4 中

MySQL 数据库的数据库配置 client 选项可以接受多个值,例如 mysqlmysql2

🌐 The database configuration client option for MySQL databases accepts several values such as mysql and mysql2.

在 Strapi 5 中

MySQL 数据库的数据库配置 client 选项只接受 mysql

🌐 The database configuration client option for MySQL database only accepts mysql.

迁移

🌐 Migration

本节重新组合了有关引入的重大更改的有用说明和程序。

🌐 This section regroups useful notes and procedures about the introduced breaking change.

注意

🌐 Notes

  • Strapi 5 在底层使用 mysql2 包处理 SQLite 数据库,并将 Knex 的 mysql 选项重写为 mysql2
  • 有关数据库客户端和配置的更多信息,请参阅数据库配置文档。
  • 请同时考虑,MySQL v8 是 Strapi 5 所需的最低版本(参见 相关重大变更条目)。

手动操作

🌐 Manual procedure

不应需要手动迁移,因为来自 升级工具 的代码修改工具将处理此更改。

🌐 No manual migration should be required as codemods from the upgrade tool will handle this change.