0

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

Lost Sould
  • 127
  • 1
  • 3
  • 13
  • 1
    Does this answer your question? [Laravel Migration Error: Syntax error or access violation: 1071 Specified key was too long; max key length is 767 bytes](https://stackoverflow.com/questions/42244541/laravel-migration-error-syntax-error-or-access-violation-1071-specified-key-wa) – Navneeta Mar 25 '22 at 15:24
  • What is your database collation? check it from `config/database.php` => `mysql` => `collation` – STA Mar 25 '22 at 15:28
  • I used this first 'charset' => 'utf8mb4', 'collation' => 'utf8mb4_unicode_ci', didnt work - then tried this 'charset' => 'utf8', 'collation' => 'utf8_unicode_ci', still doesnt work – Lost Sould Mar 25 '22 at 15:39

0 Answers0