'Laravel Migration sql error 1071 for session ID defined as (`id`);

I am trying to migrate My laravel project from inmotion to hostgator, when I try to upload the sql file I get this error

-- -- Indices de la tabla sessions -- ALTER TABLE sessions ADD UNIQUE KEY sessions_id_unique (id) MySQL said: Documentation

#1071 - Specified key was too long; max key length is 767 bytes

the instance thats throwing the error is this

--
-- Indices de la tabla `sessions`
--
ALTER TABLE `sessions`
ADD UNIQUE KEY `sessions_id_unique` (`id`);

I am using a shared hosting with sql 5.6 - the same one is being used at the previous hosting. I also tried MariaDB but the same problem.

Also I added

{
    Schema::defaultStringLength(191);
}

to the boot method at AppServiceProvider.php but it still wont work



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source