If you are familiar with Laravel environment this might be the most common issue while migrating to database. This is caused by some kind of error during migration or incomplete migration before. As a result, incomplete tables are created in the database. And, if you try to migrate next time migration error (below or similar) will be thrown. I have encounter with similar kind of issue after I have fixed Syntax error or access violation: 1071 Specified key was too long error. Here’s my error and what I did to solve this problem.
[Illuminate\Database\QueryException]SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'users' already exists (SQL: create table `users` (`id` int unsignednot null auto_increment primary key, `name` varchar(191) not null, `email` varchar(191) not null, `password` varchar(191) not null, `remember_token` varchar(100) null, `created_at` timestamp null, `updated_at` timestamp null) default character set utf8mb4 collate utf8mb4_unicode_ci)
Step 1: Reset migration
php artisan migrate:reset
Resetting migration will rollback all database migrations.
Step 2: Delete all tables from database
Delete everything from the related database including migrations either by using phpmyadmin or from terminal.
Step 3: Run migration
php artisan migrate
NOTE: Use alternative if you have already populated tables with data. This can only help you if you are at the beginning of the project.