This video tutorial is about fixing the SQLSTATE42000 Syntax error or access violation 1071 Specified key was too long max key length is 76 errors in Laravel in Windows. Simply follow those steps to fix the issue.
(My Laravel project name is "Project" and the database name is "Products")
When trying to migrate by running the CLI command the SQLSTATE[42000]-Syntax error or access violation-1071 Specified key was too long- max key length is 767 bytes error has occurred.
To fix the error,
01. Go to app, providers, AppServiceProvider
02. Update the AppServiceProvider file with the following content.
use Illuminate\Support\Facades\Schema; in top
03. Add the following line in the in boot method.
Schema::defaultStringLength(191);
04. Drop tables that have been already created.
05. Migrate again by running the CLI command.