laravel5.4 migrate报错

执行migrate报错,其他版本的正常

Migration table created successfully.
                                                                                                                                                                             
  [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 

AppServiceProvider.php 中添加下面这个代码:

use Illuminate\Support\Facades\Schema; // 别忘了这个 use 声明
public function boot()
{
    Schema::defaultStringLength(191); // boot 方法添加这行代码。
}
JellyBool
修改的评论也不能少于六个字哦!
mostwin 回复 JellyBool
修改的评论也不能少于六个字哦!