简体   繁体   中英

How to fix 'SQLSTATE[42S01]:base table or view already exists' error in laravel

When I migrate the file then it shows me a this error (image link given).I've tried migrate:rollback ,migrate:refresh but it didn't work.

https://i.imgur.com/oFjcadB.png

Illuminate\\Database\\QueryException : SQLSTATE[HY000]: General error: 1005 Can't create table seed.#sql-16d8_15 (errno: 150 "Foreign key constraint is incorrectly formed") (SQL: alter table posts add constraint posts_user_id_foreign foreign key (user_id) references users (id) on delete cascade)

Just manually delete the table

or run php artisan migrate:fresh

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM