Laravel 5.4 failing on php artis

2017-02-06  本文已影响43人  天黑北风吹

1.执行

$ php artisan migrate

报错:

[Illuminate\Database\QueryException]                                            
  SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too   
  long; max key length is 767 bytes (SQL: alter table `users` add unique `users_  
  email_unique`(`email`))                                                         
                                                                            
  [PDOException]                                                                  
  SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too   
  long; max key length is 767 bytes     

2.解决:
修改app\Providers\AppServiceProvider.php

use Illuminate\Support\Facades\Schema;

function boot()
{
    Schema::defaultStringLength(191);
}
上一篇下一篇

猜你喜欢

热点阅读