1.错误信息
Migrating: 2014_10_12_000000_create_users_table Illuminate\Database\QueryException SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'users' already exists (SQL: create table `users` (`id` bigint unsigned not null auto_increment primary key, `name` varchar(150) not null, `email` varchar(150) not ')
原因
框架自带的迁移文件 2014_10_12_000000_create_users_table
执行迁移的时候有个字段 email
没有指定varchar长度,所以默认长度会是 255,然而执行创建索引 users_email_unique
时不允许这么长
解决
修改文件 app\Providers\AppServiceProvider.php
内容如下:
use Illuminate\Support\Facades\Schema; class AppServiceProvider extends ServiceProvider { public function boot() { Schema::defaultStringLength(150); } }
标签:laravel,150,varchar,users,数据库,table,迁移,create,email From: https://www.cnblogs.com/junwuxiao/p/18307525