While running the following queries on MySQL 5.6.39,
DROP TABLE IF EXISTS `sessions`;
CREATE TABLE `sessions` (
`id` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`user_id` int(10) UNSIGNED DEFAULT NULL,
`ip_address` varchar(45) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`user_agent` text COLLATE utf8mb4_unicode_ci,
`payload` text COLLATE utf8mb4_unicode_ci NOT NULL,
`last_activity` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
ALTER TABLE `sessions`
ADD UNIQUE KEY `sessions_id_unique` (`id`);
I get the following error :
However, if I remove the part that says COLLATE=utf8mb4_unicode_ci
, everything works fine. Why is this happening ?
The above query is an export from phpMyAdmin (MySQL version 5.7.22)