I use Lumen 5.6 and mysql. when i type \"php artisan migrate\" following error occur:
SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was t
Known to work in Laravel/Lumen 7.x:
I've tried the un-commenting of AppServiceProvider::class
and other solutions mentioned above, but the following worked for me.
If you look in /vendor/laravel/lumen-framework/config/database.php
for charset
and collation
, the code checks your .env
file and resorts to utf8mb4
and utf8mb4_unicode_ci
, respectively.
If your database' charset is set to utf8
and collation to utf8_unicode_ci
, simply add the following to your .env
file:
# .env
...
DB_CHARSET=utf8
DB_COLLATION=utf8_unicode_ci
...