我试图在XAMP中创建json数据库,同时使用phpmyAdmin它显示我使用mariaDB,但在我的xamp-control panel v3.2.2
它显示正在运行mySQL on port 3306
。我使用Laravel 5.4框架来创建数据库,下面是我的移民,我正在努力执行:Laravel的mariaDB JSON支持
Schema::connection('newPortal')->create('pages', function (Blueprint $table){
$table->increments('id');
$table->string('title');
$table->string('slug')->unique()->index();
$table->json('styles')->nullable();
$table->json('content')->nullable();
$table->json('scripts')->nullable();
$table->softDeletes();
$table->timestamps();
});
现在在执行这个我收到以下错误:
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 null,
content
json null,scripts
json null,deleted_at
timestamp null' at line 1 (SQL: create tablepages
(id
int unsigned not null auto_increment primary key,title
varchar(191) not null,slug
varchar(191) not null,styles
json null,content
json null,scripts
json null,deleted_at
timestamp null,created_at
timestamp null,updated_at
timestamp null) default character set utf8mb4 collate utf8mb4_unicode_ci)
即使如果我保持不为空它会抛出相同的错误。我想要json格式的数据,我检查了支持的版本,并根据文档json格式支持从版本MariaDB 10.0.16.
开始,我正在使用10.1.21-MariaDB
帮我在这里。
您是否尝试过运行在数据库GUI或REPL该查询,然后评论查询的每一部分进行逐行?它可能会说明确切的问题是什么 – Spholt