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

Fathom Analytics | Fast, simple and privacy-focused website analytics. Fathom Analytics | Fast, simple and privacy-focused website analytics.
Achieve superior email deliverability with ToastMail! Our AI-driven tool warms up inboxes, monitors reputation, and ensures emails reach their intended destination. Sign up today for a spam-free future. Achieve superior email deliverability with ToastMail! Our AI-driven tool warms up inboxes, monitors reputation, and ensures emails reach their intended destination. Sign up today for a spam-free future.
Community Partners