[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`))
修复方法:
在App\Providers\AppServiceProvider.php文件中boot()添加:
<?php
namespace App\Providers;
use Illuminate\Support\Facades\Schema;//记得添加这个类哦
use Illuminate\Support\ServiceProvider;
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()
{
//
}
}
网友评论