使用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
解决
1 修改\app\Providers下面AppServiceProvider.php
public function boot()
{
Schema::defaultStringLength(191);
}
如果报错,头部添加use Illuminate\Support\Facades\Schema;
2 修改
/config/database.php
'engine' => null'改成
'engine' => 'InnoDB ROW_FORMAT=DYNAMIC',
3 清空缓存
php artisan cache:clear
php artisan config:clear
4 在执行php artisan migrate
转载于:https://www.jianshu.com/p/651ccb3f3109