laravel 5.8 迁移基表或视图已经存在无需删除表

我正在尝试在 laravel 5.8 上使用 migrate 但我收到此错误消息


C:\wamp\www\work_p\laravel\lvl1>php artisan migrate

Migrating: 2014_10_12_000000_create_users_table


   Illuminate\Database\QueryException  : SQLSTATE[42S01]: Base table or view alr

eady exists: 1050 Table 'users' already exists (SQL: create table `users` (`id`

bigint unsigned not null auto_increment primary key, `name` varchar(191) not nul

l, `email` varchar(191) not null, `email_verified_at` timestamp null, `password`

 varchar(191) not null, `remember_token` varchar(100) null, `created_at` timesta

mp null, `updated_at` timestamp null) default character set utf8mb4 collate 'utf

8mb4_unicode_ci')


  at C:\wamp\www\work_p\laravel\lvl1\vendor\laravel\framework\src\Illuminate\Dat

abase\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 th

is exception a

    662|         // lot more helpful to the developer instead of just the databa

se's errors.

    663|         catch (Exception $e) {

  > 664|             throw new QueryException(

    665|                 $query, $this->prepareBindings($bindings), $e

    666|             );

    667|         }

    668|


  Exception trace:


  1   PDOException::("SQLSTATE[42S01]: Base table or view already exists: 1050 T

able 'users' already exists")

      C:\wamp\www\work_p\laravel\lvl1\vendor\laravel\framework\src\Illuminate\Da

tabase\Connection.php:458


  2   PDOStatement::execute()

      C:\wamp\www\work_p\laravel\lvl1\vendor\laravel\framework\src\Illuminate\Da

tabase\Connection.php:458


  Please use the argument -v to see more details.

我在这里找到的所有解决方案都说我必须删除表格;


但是我不能在我的表上有数据我在我的用户表和所有其他表上都有数据。如果没有删除表,是否有任何解决此错误的方法?我确实尝试使用此解决方案


public function boot()

{

    Schema::defaultStringLength(191);

}

问题仍然存在


牧羊人nacy
浏览 148回答 1
1回答

幕布斯7119047

如果您不想专门运行该迁移,请在您的数据库上运行此查询INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (NULL, '2014_10_12_000000_create_users_table', '1');
打开App,查看更多内容
随时随地看视频慕课网APP