Category: Laravel, PHP

In older version of MySql or MariaDB , you may face the following error while executing the command, php artisan migrate This error occurs as from Laravel 5.4 , they have changed the default character set to utf8mb4_unicode_ci to provide support for storing emojies, characters from Arabic, Hibrew etc. To solve the error you have to go edit you AppServiceProvider.php file.

Open the file and simple paste the following code: Schema::defaultStringLength(191); And don’t forget to import the Schema namespace. You can do it by pasting the following code before Class declaration use Illuminate\Support\Facades\Schema; Please be careful about the solution above solution, if you index your email fields, you can only have max length of 191 chars.
Newsletter

Get the latest Laravel/PHP jobs, events and curated articles straight to your inbox, once a week

Glimpse streamlines Laravel development by seamlessly deploying GitHub pull requests to preview environments with the help of Laravel Forge. Glimpse streamlines Laravel development by seamlessly deploying GitHub pull requests to preview environments with the help of Laravel Forge.
Fathom Analytics | Fast, simple and privacy-focused website analytics. Fathom Analytics | Fast, simple and privacy-focused website analytics.
Shirts painstakingly handcrafted by under-caffeinated developers. Shirts painstakingly handcrafted by under-caffeinated developers.
Community Partners