-4

When I migrate I get this error:

QueryException: Base table or view already exists: 1050 Table 'users'....

enter image description here

I have the model Post but when I am migrate the database it show this message .

Marcin Nabiałek
  • 109,655
  • 42
  • 258
  • 291
Nathim Try
  • 67
  • 1
  • 8
  • 1
    You should add more details when asking for help on stack overflow, people reading your post dont know how you got there or what you are trying to do. more details => more accurate help. – N69S Nov 20 '19 at 08:51
  • Does this answer your question? [SQLSTATE\[42S01\]: Base table or view already exists: 1050 Table 'payments' already exists (SQL: create table \`payments\`](https://stackoverflow.com/questions/47729713/sqlstate42s01-base-table-or-view-already-exists-1050-table-payments-alread) – Douwe de Haan Nov 20 '19 at 09:14
  • For those who end up being here because of the "migrations" table is not created automatically, this [link](https://stackoverflow.com/a/60095493/10539212) might help. – Phantom1412 Feb 06 '20 at 13:00

2 Answers2

1

your migration stopped at some point, wich resulted in a created table in database and migration not marked as already completed.

Remove the table manually then run php artisan migrate

If it is a new installation: just run php artisan migrate:fresh (this will delete all the tables in the database)

N69S
  • 16,110
  • 3
  • 22
  • 36
0

The error message told you that user table already exists. You are again migrating the same table. Just run php artisan migrate:fresh. It will create all table from scratch.

Mahmud hasan
  • 918
  • 10
  • 13