例: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 中的
引入 use Illuminate\Support\Facades\Schema;
在 boot 方法中添加
Schema::defaultStringLength(191);
注:如果还有 Mysql 执行安全模式检查问题
在 config/database.php 的 mysql 的 选项配置了严格模式默认为 true,修改为:’strict’ => false,