search

Home  >  Q&A  >  body text

Laravel database field json format error reporting

Using laravel5.4, there is a field in json format, which is defined in the migration file like this:

$table->json('fruits')->nullable();

Error reporting when executing php artisan migrate:

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' at line 1
ringa_leeringa_lee2753 days ago670

reply all(1)I'll reply

  • 阿神

    阿神2017-05-16 16:48:49

    The

    mysql version is too low, json type fields can only be used on the >=mysql5.7 version.

    reply
    0
  • Cancelreply