9

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?

3 Answers 3

19

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/

Sign up to request clarification or add additional context in comments.

Comments

3

Yes, it's a version issue, see https://mariadb.com/kb/en/library/mariadb-vs-mysql-compatibility/

You're using MariaDB 10.1, which is based on MySQL 5.6/5.7 (hence the innodb version). But the JSON data type was added in MySQL 8.0. It looks like as of this time MariaDB doesn't support the JSON data type.

3 Comments

I see. Well, i will just go with Ebby's recommendation of using LONGTEXT.
"But the JSON data type was added in MySQL 8.0" No the JSON datatype was already added in MySQL in version 5.7 dev.mysql.com/doc/refman/5.7/en/json.html .. MySQL 8.0 added more JSON functions to work with JSON.
Well Raymond, my mysql version is 5.6 . I do not understand how come XAMPP ships with such an old version
0

The JSON data type as added in version 5.7 and is improved in 8. MariaDB does not have a JSON data type

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.