I'm trying to add a column of type JSON to one of my tables. I'm using XAMPP with phpmyadmin. The server version is 10.1.31-MariaDB. The innodb version is 5.6.36-83.0
When i try to select the JSON type from the select-box in phpmyadmin, i do not see anything about JSON. Also, running this query results in a "syntax error":
ALTER TABLE my_table
ADD `some_column` json;
I've seen both in the manual, and in various tutorials, that mysql indeed does support JSON type.
Is it a version issue? To be honest, i'm very confused about the whole mysql versioning situation. I see on Wikipedia, that the latest stable release is 8.0.11, whereas mine seems to be something completely different(i dont know which is relevant: the "server" or the "innodb" version) I would assume that XAMPP uses the latest mysql version, but maybe i'm wrong.
Can someone shed some light on the issue? If it is actually a version thing, would it be possible to upgrade, while still using XAMPP?
MySQL supports a native JSON data type defined by RFC 7159 that enables efficient access to data in JSON (JavaScript Object Notation) documents. The JSON data type provides these advantages over storing JSON-format strings in a string column: Automatic validation of JSON documents stored in JSON columns.
Unless otherwise indicated, the JSON functions were added in MySQL 5.7. 8. A set of spatial functions for operating on GeoJSON values is also available.
MySQL version 5.7. 8 introduces a JSON data type that allows you to access data in JSON documents.
It seems that this data type is only available from MariaDB version 10.2.7. You can use LONGTEXT instead, because according to the docs JSON is only an alias for LONGTEXT.
https://mariadb.com/kb/en/library/json-data-type/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With