Laravel 默认使用utf8mb4字符编码,而不是的utf8编码.因此运行php artisan migrate会出现如下错误: [Illuminate\Database\QueryException] SQLSTATE[]: Syntax error or access violation: Specified key was too long; max key length is bytes (SQL: alter table users add unique users_email_u…
 转自:https://segmentfault.com/a/1190000008416200 laravel运行命令migrate时报错: 1071 Specified key was too long; max key length is 1000 bytes (S   QL: alter table `users` add unique `users_email_unique`(`email`))   [PDOException]   SQLSTATE[42000]: Syntax err…
今天在学习laravel的路由模型绑定时,在按照文档执行php artisan migrate时报错. In Connection.php line 664: SQLSTATE[42000]: 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`(…
ref: https://stackoverflow.com/questions/1814532/1071-specified-key-was-too-long-max-key-length-is-767-bytes 转载 https://blog.csdn.net/LJFPHP/article/details/80406907 一.背景 今天把服务器的数据库导出了一份sql文件,准备导入到本地,但是在导入的时候,报了个错: Syntax error or access violation: 1…
[Err] 1071 - Specified key was too long; max key length is 767 bytes 这个会出现在MySQ5.7以下版本 因为没有启用innodb_large_prefix MySQL 5.6: MySQL 5.7: 简单办法:如果要求不是很高 ,也可以直接把表字段varchar(255)设置为varchar(64) 另外一种:修改配置 (重启服务会失效) mysql> show variables like '%innodb_large_pr…
laravel 执行 php artisan migrate 安装数据库报 1071 Specified key was too long; max key length is 1000 bytes 数据库不支持长字节 需要在 \app\Providers\AppServiceProvider.php文件里面添加状态码191 具体代码如下  1.DB engine 是MyIsAm改为InnoDB2.字符集是 utf8 ,1个utf8=3bytes3.最后就是 (100+255)*3>1000 所…
1.原因:在进行 迁移文件生成时,程序并未给varchar类型字段设置 合适的长度,导致报错. 2.解决办法:找到database/ 目标迁移文件,修改其中类型为string的字段长度,建议不要超过255,否则报错 [然后再次运行php artisan migrate 即可成功] 示例: MySQL: ERROR 1071 (42000): Specified key was too long; max key length is 767 bytes 今天测试遇到了这样的问题: MySQL> u…
vue使用v-for时vscode报错 Elements in iteration expect to have 'v-bind:key' directives Vue 2.2.0+的版本里,当在组件中使用v-for时,key是必须的错误提示:[vue-language-server] Elements in iteration expect to have 'v-bind:key' directives.Renders the element or template block multipl…
Laravel 5.5 环境,php artisan migrate 之后,出现错误如题. 检查了一下,代码是这样的: $table->increments('id'); $table->string('username')->uniq(); $table->string('email')->nullable()->uniq(); $table->text('avatar_url')->nullable(); $table->string('phone…
废话不多说,报错如下: DataNucleus.Datastore (Log4JLogger.java:error(115)) - An exception was thrown while adding/validating class(es) : Specified key was too long; max key length is 767 bytescom.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Specified…