当我运行命令时 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/