skip to Main Content
Laravel – #1071 Specified Key Was Too Long; Max Key Length Is 767 Bytes

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

When first time I installed the Laravel 5.4 and generate the Auth module using artisan command. When I am going to run Laravel migration command I got an error like “Specified key was too long; max key length is 767 bytes”, I want to share solution of that issue on my blog.

I trying to find the solution on google for resolving this issue. As per Laravel 5.4.* documentation, You need to set default string length on Boot method like.

First of all, Open the App Service Provider at “app/Providers/AppServiceProvider.php” and add below code.

Specified key was too long; max key length is 767 bytes

use Illuminate\Support\Facades\Schema;

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

Now, let’s fire the migration command and check the issue was resolved or not please write the comment.

Saroj

I am a web designer and developer part-time blogger. Write something on some free time. Find my every day thought here :)

Leave a Reply

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

Back To Top