【问题标题】:How to remove this error while passing command through terminal? [duplicate]通过终端传递命令时如何消除此错误? [复制]
【发布时间】:2018-07-13 08:41:06
【问题描述】:

PS W:\laravel_xampp\htdocs\blog> php artisan 迁移

迁移表创建成功。

在 Connection.php 第 664 行:

SQLSTATE[42000]:语法错误或访问冲突:1071 规范 确定的密钥太长;最大密钥长度为 767 字节(SQL: al 三表users添加唯一users_email_unique(email))

在 Connection.php 第 458 行:

SQLSTATE[42000]:语法错误或访问冲突:1071 规范 确定的密钥太长;最大密钥长度为 767 字节

【问题讨论】:

标签: laravel


【解决方案1】:

如迁移指南中所述,要解决此问题,您只需编辑 AppServiceProvider.php 文件并在引导方法中设置默认字符串长度:

use Illuminate\Support\Facades\Schema;

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

【讨论】:

    猜你喜欢
    • 2014-08-06
    • 1970-01-01
    • 2018-09-12
    • 2015-12-14
    • 2015-01-29
    • 2019-06-08
    • 1970-01-01
    • 2013-01-27
    • 1970-01-01
    相关资源
    最近更新 更多