当前文章: 首页 >> 编程开发 >> PHP >> SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long
聚划算
«   2020年5月   »
123
45678910
11121314151617
18192021222324
25262728293031
网站分类
    海外云服务器CPS_轻量拓展全民云计算企业云服务器云盾证书
标签列表
最近发表
友站访问排行

SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long

laravel执行php artisan migrate命令时出错:

-bash-4.2$ php artisan migrate
Migration table created successfully.
Migrating: 2014_10_12_000000_create_users_table

   Illuminate\Database\QueryException  : 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`(`email`))

  at /web/dev/laravel/vendor/laravel/framework/src/Illuminate/Database/Connection.php:664
    660|         // If an exception occurs when attempting to run a query, we'll format the error
    661|         // message to include the bindings with SQL, which will make this exception a
    662|         // lot more helpful to the developer instead of just the database's errors.
    663|         catch (Exception $e) {
  > 664|             throw new QueryException(
    665|                 $query, $this->prepareBindings($bindings), $e
    666|             );
    667|         }
    668| 

  Exception trace:

  1   PDOException::("SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 767 bytes")
      /web/dev/laravel/vendor/laravel/framework/src/Illuminate/Database/Connection.php:458

  2   PDOStatement::execute()
      /web/dev/laravel/vendor/laravel/framework/src/Illuminate/Database/Connection.php:458

  Please use the argument -v to see more details.



解决方法: 

内容已经加密,请关注公众号后发送1008获取密码; 使用微信扫描二维码,或者微信直接上搜索公众号jues进行关注;


声明:本站原创文章,转载、复制、使用等请注明出处。
标题SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long
作者jues
地址: http://blog.jues.org.cn/post/sqlstate42000-syntax-error-or-access-violation-1071-specified-key-was-too-long.html

发表评论:

Powered By Z-BlogPHP 1.6.0 Valyria Powered By Z-BlogPHP © 2018 jues博客 Copyright Your WebSite.Some Rights Reserved.联系站长 Themes by jues

分享:

支付宝

微信