laravel migrate时报错:Syntax error or access violation: 1071 Specified key was too long; max key length is 767 bytes

在按照文档执行php artisan migrate时报错。

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`))

  解决方法

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);
    }
}

  

原文地址:https://www.cnblogs.com/liujie-php/p/12181958.html

时间: 2024-10-01 05:25:54

laravel migrate时报错:Syntax error or access violation: 1071 Specified key was too long; max key length is 767 bytes的相关文章

Laravel 5.4 migrate报错:Syntax error or access violation: 1071 Specified key was too long; max key length is 767 bytes (SQL: alter table `users` add unique `us ers_email_unique`(`email`))

Laravel 5.4 migrate报错:Syntax error or access violation: 1071 Specified key was too long; max key length is 767 bytes (SQL: alter table `users` add unique `us     ers_email_unique`(`email`)) public function up() { Schema::create('users', function (Blu

php artisan migrate时出现 SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 1000 bytes解决办法

在测试队列中运用artisan命令行 php artisan queue:table php artisan migrate时出现 SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 1000 bytes Change database.php which is in config folder where it says 'charset' =

SQLSTATE[42000]: Syntax error or access violation: 1253 COLLATION 'utf8mb4_unicode_ci' is not valid for CHARACTER SET 'binary'

SQLSTATE[42000]: Syntax error or access violation: 1253 COLLATION 'utf8mb4_unicode_ci' is not valid for CHARACTER SET 'binary' 对数据表更改,然后执行数据迁移命令php artisan migrate,之后报错如下: 解决办法: 参考:https://www.hellojava.com/a/68286.html SQLSTATE[42000]: Syntax error

SQLSTATE[42000]: Syntax error or access violation

出现这种问题 直接修改my.cnf 即可 在mysqld下面添加sql_mode="" 然后保存 ->重启mysql 原文地址:https://www.cnblogs.com/zydtm/p/10178388.html

Laravel 5.4 migrate时报错: Specified key was too long error

Laravel 5.4默认使用utf8mb4字符编码,而不是之前的utf8编码.因此运行php artisan migrate 会出现如下错误: [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

Laravel 5 migrate时报错: Specified key was too long error

Laravel 5.4默认使用utf8mb4字符编码,而不是之前的utf8编码.因此运行php artisan migrate 会出现如下错误: [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

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

Laravel 默认使用utf8mb4字符编码,而不是的utf8编码.因此运行php artisan migrate会出现如下错误: [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

linux的shell脚本报错“syntax error near unexpected token `”的解决

今天写了一个shell脚本,老报错检查了一下基本的语法并没有发现错误.后来经过百度解决掉了,现总结如下. 错误现象:执行shell脚本,老报错"syntax error near unexpected token `" 解决办法:vim -b example.sh打开文件,发现文件每一行的末尾多了一个^M,这个问题在使用vim example.sh查看是看不见的,只能通过报错来判断使用vim -b才能发现问题. 因为MS-DOS及Windows是回车+换行来表示换行,因此在Linux下

安装Python的psutil模块时报错:error: command 'gcc' failed with exit status 1

安装Python的psutil模块: tar zxvf psutil-2.0.0.tar.gz cd psutil-2.0.0 python setup.py install 报错: running install running bdist_egg ...... psutil/_psutil_linux.c:12:20: error: Python.h: No such file or directory In file included from psutil/_psutil_linux.c