symfony - 语法错误或访问冲突 : 1064 You have an error in your SQL In symfony

标签 symfony symfony4 doctrine-migrations

当我运行命令时 php bin/console doctrine:migration:migrate我收到这个错误我不知道从哪里来。

命令行错误:
在 AbstractMySQLDriver.php 第 99 行中:

An exception occurred while executing 'CREATE TABLE user (id INT AUTO_INCREMENT NOT NULL, email VARCHAR(180) NOT NU LL, roles JSON NOT NULL, password VARCHAR(255) NOT NULL, UNIQUE INDEX UNIQ_8D93D649E7927C74 (email), PRIMARY KEY(id )) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ENGINE = InnoDB':

SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'JSON NOT NULL, password VARCHAR(255) NOT NULL, UNIQUE INDEX UNIQ_8D93D649E7927C7' at line 1



在 PDOConnection.php 第 109 行:

SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'JSON NOT NULL, password VARCHAR(255) NOT NULL, UNIQUE INDEX UNIQ_8D93D649E7927C7' at line 1



在 PDOConnection.php 第 107 行:

SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'JSON NOT NULL, password VARCHAR(255) NOT NULL, UNIQUE INDEX UNIQ_8D93D649E7927C7' at line 1



我的环境
my env

最佳答案

安德烈是对的。你要么升级你的数据库,要么(更容易)配置你的 symfony 以使用较低版本的 MySQL。

config/packages/doctrine.yaml

doctrine:
dbal:
    # configure these for your database server
    driver: 'pdo_mysql'
    server_version: '5.6'

here您可以找到一个表,其中包含 MySQL 和 MariaDB 的兼容性。

关于symfony - 语法错误或访问冲突 : 1064 You have an error in your SQL In symfony,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53366186/

相关文章:

php - SFTP 上的文件在开头显示附加字符

deployment - Capifony 无法预热缓存

php - 交响乐团 : Pagination with inner join

php - symfony 4 多种形式循环 Twig 提交

doctrine-orm - 不使用指定配置的 Doctrine 迁移

php - 将 Docker 容器部署到 AWS 时运行数据库迁移命令

php - 我无法使用 querybuilder 在存储库中构建特定请求

symfony4 - 如何从 API 平台文档中隐藏路由

Symfony AutoWire 多个服务同一类

php - 从所有迁移文件 symfony 学说生成一个迁移?