Laravel

Specified key was too long – Laravel migration

Specified key was too long – Laravel migration

Specified key was too long Laravel migration, I have installed laravel 5.4 and run php artisan migrate in terminal, but I have faced with the error in terminal. I dint face with these error in my previous laravel basic installation. After a long research have found the solution.

Steps I did :

Step 1 : create-project –prefer-dist laravel/laravel laravel5-4
Step 2 : Changed database details in database.php
Step 3 : php artisan migrate

 Error I faced :

 Have found the 2 kind of solution for this :

 Solution 1 :

Add below 2 lines in database.php

My file :

Solution 2 :

Add charset and collation for your table in your migration file

For eg :

Specified key was too long laravel

Hope it will help someone.