-4

I just start to learn laravel as an online course and do all instructions step by step behind the instructor but when I try to make migrate I get an error and doesn't migrate to database. what's wrong?

SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'users' already exists (SQL: create table users (id int unsigned not null auto_increment primary key, name varchar(255) not null, email varchar(255) not null, password varchar(255) not null, remember_token varchar(100) null, created_at timestamp null, updated_at timestamp null) default character set utf8mb4 collate utf8mb4_unicode_ci)

In Connection.php line 449:

SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'users' already exists

error screenshot

ᴄʀᴏᴢᴇᴛ
  • 2,939
  • 26
  • 44

3 Answers3

0

Go to your data base and delete the table users and then re-do : php artisan migrate

Mohcin Bounouara
  • 593
  • 4
  • 18
0

you need refresh your database this error becouse users table in your DB please Go to your terminal and run this commend

php artisan migrate:refresh

or go to your phpmyadmin and drop your tables on DB to run your migrations from scratch using this commend after drop your DB

 php artisan migrate

congratulations ;)

0
  1. Delete Users table(all tables excepted migration if there is an entry in migration table truncate migration table)
  2. run composer dump command.
  3. run php artisan migrate.

enjoy :)