I have this mysql:
CREATE TABLE security_user
(
id INT AUTO_INCREMENT NOT NULL,
email VARCHAR(180) NOT NULL,
roles JSON NOT NULL,
password VARCHAR(255) NOT NULL,
UNIQUE INDEX UNIQ_52825A88E7927C74 (email),
PRIMARY KEY(id)
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ENGINE = InnoDB
When I try use it in php error I have error:
1064 - Something is wrong in your syntax obok 'JSON NOT NULL, password VARCHAR(255) NOT NULL, UNIQUE INDEX UNIQ_52825A88E7927C7' in line 1
I have installed Xampp Server: https://www.apachefriends.org/pl/download.html
How can I repair this?
The current version (actually 7.1.28, 7.2.17 and 7.3.4) of XAMPP is using MariaDB 10.1.38 . This version doesn't support the JSON
datatype. At least version 10.2.7 is required (see JSON Data Type ).
In your case I would consider to define a clean normalized relation (user <--> role) instead of of storing the roles in a JSON array.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.