$ n8n Initializing n8n process n8n ready on ::, port 5678 Migrations in progress, please do NOT stop the process. Starting migration AddMockedNodesColumnToTestDefinition1733133775640 Migration “AddMockedNodesColumnToTestDefinition1733133775640” failed, error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘(‘[]’) NOT NULL’ at line 1 There was an error running database migrations You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘(‘[]’) NOT NULL’ at line 1
MySQL 版本过低或不兼容 JSON/数组类型 导致的。
根本原因
n8n 的迁移脚本里尝试在 MySQL 创建类似 JSON[] 或数组类型的列:
ALTER TABLE … ADD COLUMN … JSON NOT NULL
- 旧版本 MySQL(< 5.7)不支持 JSON 类型
- 报错中 ‘([]) NOT NULL’ 就是 TypeORM 尝试映射数组/JSON类型时语法不被识别
解决方案
升级 MySQL
n8n 官方要求 MySQL ≥ 8.0 或 MariaDB ≥ 10.3
如果你当前 MySQL 版本低于 8,迁移会失败
升级到 MySQL 8 后,JSON 类型会被支持,迁移就能正常执行