当前位置:   article > 正文

laravel migrate 报错:SQLSTATE[42000]: Syntax error or access violation_sqlstate[42000]: syntax error or access violation:

sqlstate[42000]: syntax error or access violation: 1142 select command denie

报错信息

 SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 767 bytes (SQL: alter table `users` a
  dd unique `users_email_unique`(`email`))
  • 1
  • 2

解决:

	// app\Providers\AppServiceProvider.php
	use Illuminate\Support\Facades\Schema;
	
	public function boot()
    {
        Schema::defaultStringLength(191);
    }
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7

网上其它方法:

show variables like 'innodb_large_prefix';  

set global innodb_file_per_table=on;

set global innodb_large_prefix=on;

set global innodb_file_format_max='Barracuda';

set global innodb_file_format='Barracuda';
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/IT小白/article/detail/625064
推荐阅读
相关标签
  

闽ICP备14008679号