0

I'm trying to install laravel voyager but getting this error.

SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 1000 bytes (SQL: alter table users add unique users_email_unique(email))

This is my \app\Providers\AppServiceProvider.php

public function boot()
{
    Schema::defaultStringLength(191);
}

This is my config\database.php

'charset' => 'utf8',
'collation' => 'utf8mb4_unicode_ci',
'prefix' => '',
'prefix_indexes' => true,
'strict' => true,
'engine' => 'InnoDB ROW_FORMAT=DYNAMIC',

AND MY DB HAS COLATION utf8mb4_unicode_ci

  • 1
    Does this answer your question? [#1071 - Specified key was too long; max key length is 1000 bytes](https://stackoverflow.com/questions/8746207/1071-specified-key-was-too-long-max-key-length-is-1000-bytes) – Dan Nov 17 '20 at 09:53

2 Answers2

0

you can increase that

SET @@global.innodb_large_prefix = 1;

for example


mysql> set global innodb_large_prefix = ON;
Query OK, 0 rows affected (0.00 sec)

dılo sürücü
  • 1,989
  • 1
  • 12
  • 19
-1

A similar error is described here.

https://laravel-news.com/laravel-5-4-key-too-long-error

there is also information here

Laravel Migration Error: Syntax error or access violation: 1071 Specified key was too long; max key length is 767 bytes Successful programming = )

Dharman
  • 21,838
  • 18
  • 57
  • 107