Reputation: 6697
I'm following this tutorial. I've installed passport using composer as well. But when I run this command:
php artisan migrate
It throws:
In Connection.php line 664:
SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'users' already exists (SQL: cre ate table
users
(id
int unsigned not null auto_increment primary key,name
varchar(255) n ot null,password
varchar(255) not null,remember_token
varc har(100) null,created_at
timestamp null,updated_at
timestamp null) default character set utf8mb4 collate utf8mb4_unicode_ci)In Connection.php line 458:
SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'users' already exists
Any idea how can I fix the problem ?
Upvotes: 0
Views: 322
Reputation: 443
The first you can config connect database, the secon you open foler project\app\Providers and edit file AppServiceProvider.php the following below, now you can run php artisan migrate again
<?php
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);
}
/**
* Register any application services.
*
* @return void
*/
public function register()
{
//
}
}
Upvotes: 0
Reputation: 226
Your migrations table missed some migration results. You must delete user table manually from the database and then try again "php artisan migrate".
You can delete table easily with the thinker
php artisan tinker
Schema::drop('users')
Upvotes: 0
Reputation: 917
If you are at initial stage of your project remove users table and its corresponding migration table row from migrations table an run passport install.
Upvotes: 0