当前位置:   article > 正文

【laravel5.8】 SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max_laravel8 syntax error or access violation: 1071 sp

laravel8 syntax error or access violation: 1071 specified key was too long;
  1. D:\wwwroot\www.test.com>php artisan admin:install
  2. Migration table created successfully.
  3. In Connection.php line 664:
  4. SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 1000 bytes (S
  5. QL: alter table `users` add unique `users_email_unique`(`email`))
  6. In Connection.php line 458:
  7. SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 1000 bytes

在app\Providers\AppServiceProvider.php添加默认值

  1. <?php
  2. namespace App\Providers;
  3. use Illuminate\Support\ServiceProvider;
  4. use Illuminate\Support\Facades\Schema; //add fixed sql
  5. class AppServiceProvider extends ServiceProvider
  6. {
  7. /**
  8. * Bootstrap any application services.
  9. *
  10. * @return void
  11. */
  12. public function boot()
  13. {
  14. Schema::defaultStringLength(191); //add fixed sql
  15. }
  16. /**
  17. * Register any application services.
  18. *
  19. * @return void
  20. */
  21. public function register()
  22. {
  23. //
  24. }
  25. }

 

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

闽ICP备14008679号