Android

“Laravel 5.6 : Specified key was too long error” 

Wordpress

is our main topic for this article.

https://www.programmingschool.io

As you know laravel is one of the best and favourite framework we have but Laravel 5.6 made a change to their default database character set, and it’s now utf8mb4 which support for storing emojis.

If you are running latest version of laravel and you are running MySQL v5.7.*  and higher you do not need to do anything.

But if you are running MariaDB or older version of MySQL you may face this error when you trying to run php artisan migrate : 

Solution :

As mentioned in official documentation, to fix this all you need to do is edit your AppServiceProvider.php file and inside the boot method set a default string lenght :

That’s it. after this everything works normally and you can build awesome things 🙂 .

If you wat to install laravel through composer then please refer this link or if you want to build to-do application using laravel hen please refer this link.

If you like this post please share and also join our news letter. Thanks.

Happy Codding!

Cheers!

 

LEAVE A REPLY

Please enter your comment!
Please enter your name here