当前位置:   article > 正文

Syntax error or access violation: 1071 Specified key was too long; max key length is 1000 bytes (S

syntax error or access violation: 1071 specified key was too long; max key l

安装laravel-admin   执行:php artisan admin:install报错如下:

In Connection.php line 664:

  SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 1000 bytes (S
  QL: alter table `users` add unique `users_email_unique`(`email`))
In PDOStatement.php line 107:

  SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 1000 bytes
In PDOStatement.php line 105:

  SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 1000 bytes

 

[PDOException] 
SQLSTATE [42000]:语法错误或访问冲突:1071指定密钥太长; 最大密钥长度为1000字节

要解决此问题,您只需编辑 AppServiceProvider.php文件并在 boot方法内设置默认字符串长度:

  1. use Illuminate\Support\Facades\Schema;
  2. public function boot()
  3. {
  4. Schema::defaultStringLength(191);
  5. }

在执行php artisan admin:install   删除之前创建的表,就正常了

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/凡人多烦事01/article/detail/599614
推荐阅读
相关标签
  

闽ICP备14008679号