Error “Index column size too large. The maximum column size is 767 bytes. ”When running migrations.

When running Laravel String migrations, I came across the error:
SQLSTATE [HY000]: General error: 1709 Index column size too large. The maximum column size is 767 bytes. (SQL: alter table `users` add unique` users_email_unique` (`email`)) In Connection.php line 458: SQLSTATE [HY000]: General error: 1709 Index column size too large. The maximum column size is 767 bytes.

I saw the suggestion to add the code:

Schema::defaultStringLength (191);

In the file app / Providers / AppServiceProvider.php which would set the maximum string length to 191 characters, but that didn't solve me.
I have run the bank locally with Php my admin, and as this comment in the official repository, just inside Php my admin (or whichever way you prefer) change the global variables, leaving them with the following values:

Alternatively, use a more current version of MySQL.

Vlad Tchompalov

Leave a Reply

Your email address will not be published. Required fields are marked *

en_USEnglish