Laravel 5.6 : Specified key was too long error — codementor.tech

chirag patel
1 min readJul 4, 2018

--

https://www.codementor.tech/laravel-specified-key-was-a-too-long-error/

Today i am writing about this topic because recently i came up with this “Specified key was too long error” error while running php artisan migrate command in laravel.

The solution was very easy just need to edit AppServiceProvide.php file but as i am developer so i have write blog at codementor.tech.

Solution -

use Illuminate\Support\Facades\Schema;

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

If you want to read full specification and solution please visit THIS link.

Thanks for reading.

Happy Coding!

Cheers!

--

--

chirag patel
chirag patel

Written by chirag patel

Software Developer , Author @codemetor.tech

Responses (1)