[Illuminate\Database\QueryException] SQLSTATE[42S01]: Base table or view already exists: 1050 Table ...

[Illuminate\Database\QueryException]
SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'users' alre
ady exists (SQL: create table `users` (`id` int unsigned not null auto_incr
ement primary key, `username` varchar(255) not null, `email` varchar(255) n
ot null, `password` varchar(255) not null, `created_at` timestamp default 0
 not null, `updated_at` timestamp default 0 not null) default character set
 utf8 collate utf8_unicode_ci)

  错误原因不在这里。

很明显可以看到这是对数据库操作时产生的错误,但是我出错在他的上一步,

 [Illuminate\Database\QueryException]
  SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 1000 bytes (SQL: alter table `users` add un
  ique `users_email_unique`(`email`))



  [PDOException]
  SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 1000 byte

  上一步创建表时少创建了一个表,由于同时创建3个表格,所以少了一个当时也没有看出来,但是再进行下面对数据库的操作时产生了问题,所以我的办法是把数据表全部重新做一遍,清除错误。

 

转载于:https://www.cnblogs.com/luxia/p/7929651.html

你可能感兴趣的:([Illuminate\Database\QueryException] SQLSTATE[42S01]: Base table or view already exists: 1050 Table ...)