Lumen 5.6 Migrate Error Specified key was too long max key length is 767 bytes

前端 未结 6 1436
生来不讨喜
生来不讨喜 2021-02-14 16:45

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         


        
6条回答
  •  面向向阳花
    2021-02-14 17:35

    You need couple of things to do. I also faced this issue and fixed it by following these two steps

    1. Go to app.php in bootstrap directory and uncomment or modify this line.

      // $app->register(App\Providers\AppServiceProvider::class);
      
    2. Now you need to define boot()function in AppServiceProviderfile

          public function boot()
          {
             Schema::defaultStringLength(191);
          }
      

    Then you are good to go!

提交回复
热议问题