Laravel
5.4默认使用utf8mb4
字符编码,而不是之前的utf8
编码。因此运行php artisan migrate
会出现如下错误:
Illuminate\Database\QueryException
SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 1000 bytes
原因:mysql版本较低
解决办法:
app\Providers\AppServiceProvider.php
下boot()
方法添加:
Schema::defaultStringLength(191);
标签:violation,max,long,1071,access,key,42000
From: https://www.cnblogs.com/nojiwai/p/17017978.html