Thursday, March 23, 2017

[Laravel 5.4] syntax error or access violation: 1071 Specified key was too long: max key length is 767 bytes

Error message :
SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 767 bytes.
Visit the AppServiceProvider.php file in your project : \app\Providers\AppServiceProvider.php

C:\wamp\htdocs\m\app\Providers\AppServiceProvider.php


and this line within boot() function
Schema::defaultStringLength(191);

and this line under namespace:
use Illuminate\Support\Facades\Schema;

Example code :

Reference

https://github.com/laravel/framework/issues/17508

No comments :

Post a Comment