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 error or access violation: 1071 Specified key was too long; max key length is 1000 bytes

解决:

  1. 升级MySql版本到5.5.3以上。

  2. 手动配置迁移命令migrate生成的默认字符串长度,App/Providers/AppServiceProvider.php

    <?php
    namespace App\Providers;
    
    use Illuminate\Support\ServiceProvider;
    use Illuminate\Support\Facades\Schema; class AppServiceProvider extends ServiceProvider
    {
    /**
    * Bootstrap any application services.
    *
    * @return void
    */
    public function boot()
    {
    Schema::defaultStringLength(191);
    }

laravel 运行migrate报错 1071 Specified key was too long的更多相关文章

  1. 【laravel5.4】php artisan migrate报错:Specified key was too long; max key length is 767 bytes

    1.原因:在进行 迁移文件生成时,程序并未给varchar类型字段设置 合适的长度,导致报错. 2.解决办法:找到database/ 目标迁移文件,修改其中类型为string的字段长度,建议不要超过2 ...

  2. laravel报错1071 Specified key was too long; max key length is 1000 bytes

    Laravel 默认使用utf8mb4字符编码,而不是的utf8编码.因此运行php artisan migrate会出现如下错误: [Illuminate\Database\QueryExcepti ...

  3. Mac上PyCharm运行多进程报错的解决方案

    Mac上PyCharm运行多进程报错的解决方案 运行时报错 may have been in progress in another thread when fork() was called. We ...

  4. 在ios7真机上和iOS6模拟器上运行是好的,而在iOS6真机上运行却报错

    在ios7真机上和iOS6模拟器上运行是好的,而在iOS6真机上运行却报错 解决方法: 或是都设置为yes.. Build Active Architecture Only的意思是只生成适应的指令集

  5. 运行yum报错Error: Cannot retrieve metalink for reposit

    http://www.netpc.com.cn/593.html 运行yum报错Error: Cannot retrieve metalink for reposit 今天给Centos通过rpm - ...

  6. 转:运行yum报错Error: Cannot retrieve metalink for reposit

    http://www.netpc.com.cn/593.html 运行yum报错Error: Cannot retrieve metalink for repository: epel. Please ...

  7. 新建SpringBoot项目运行页面报错Whitelabel Error Page This application has no explicit mapping for /error, so yo

    新建SpringBoot项目运行页面报错Whitelabel Error Page This application has no explicit mapping for /error, so yo ...

  8. django migrate报错(提前删除表等)

    python3 manage.py makemigrations python3 manage.py migrate ##报错 改为##更改migrates的状态 python3 manage.py ...

  9. laravel安装一直报错

    laravel安装一直报错 原因: 1.找到php版本是否对应 2.缺少第三方扩展库vendor 需要composer update 解决链接:https://learnku.com/docs/lar ...

随机推荐

  1. 洛谷——P1094 纪念品分组

    https://www.luogu.org/problem/show?pid=1094#sub 题目描述 元旦快到了,校学生会让乐乐负责新年晚会的纪念品发放工作.为使得参加晚会的同学所获得 的纪念品价 ...

  2. [jQuery]$.get跨域提交不发送原因

    使用 $.ajax({ url: "http://pastebin.com/embed_js.php?i=sy9gt3FR", dataType: "jsonp" ...

  3. Seaside HDU 3665 【Dijkstra】

    Problem Description XiaoY is living in a big city, there are N towns in it and some towns near the s ...

  4. Codeforces 474 C. Captain Marmot

    4*4*4*4暴力+点的旋转+推断正方型 C. Captain Marmot time limit per test 1 second memory limit per test 256 megaby ...

  5. git笔记之eclipse使用github远程仓库进行版本号管理

    原文地址:http://dtbuluo.com/90.html 这里记录一下eclipse开发工具中git的使用说明. 环境:centOS.eclipse-jee-kepler-SR2-linux-g ...

  6. HDU3117-Fibonacci Numbers(矩阵高速幂+log)

    题目链接 题意:斐波那契数列,当长度大于8时.要输出前四位和后四位 思路:后四位非常easy,矩阵高速幂取模,难度在于前四位的求解.  已知斐波那契数列的通项公式:f(n) = (1 / sqrt(5 ...

  7. tslib-触摸屏校准

    5.1移植tslib 5.1.1在https://github.com/kergoth/tslib下载最新的tslib 5.1.2为虚拟机里的Linux系统安装工具  sudo apt-get ins ...

  8. ReflectionSugar 通用反射类

    http://www.cnblogs.com/sunkaixuan/p/4635710.html

  9. OpenCASCADE 包说明

    转载地址:http://www.cppblog.com/eryar/archive/2012/06/30/180916.html 一.简介 Introduction to Package gp gp是 ...

  10. BZOJ 1441 裴蜀定理

    思路: 若a,b是整数,且(a,b)=d,那么对于任意的整数x,y,ax+by都一定是d的倍数,特别地,一定存在整数x,y,使ax+by=d成立. 它的一个重要推论是:a,b互质的充要条件是存在整数x ...