SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/lengyue1084/article/details/88216101

app/Providers/AppServiceProvider.php  设置默认长度

<?php

namespace App\Providers;

use Illuminate\Support\ServiceProvider;
use Illuminate\Support\Facades\Schema;//添加

class AppServiceProvider extends ServiceProvider
{
    /**
     * Bootstrap any application services.
     *
     * @return void
     */
    public function boot()
    {
        //
        Schema::defaultStringLength(191);//设置默认长度
    }

    /**
     * Register any application services.
     *
     * @return void
     */
    public function register()
    {
        //
    }
}

猜你喜欢

转载自blog.csdn.net/lengyue1084/article/details/88216101