SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'xxxx' already exists. This error comes up when you try to run the migration when the table already exists in the database.

Possible Solution 1

php artisan migrate:refresh

Please note, this is combination of rollback + fresh, So it will delete all the tables and creates newly. So, do it at your own risk.

Possible Solution 2


In the above image the batch number shows the number of migration created until now. "1" indicates first set of migrations that should be executed. So consider  in the above image the "audit_table" is one which gives you the error, in that case change the batch number of audit tabel and other remaining tables to 2.

In this case migrations with batch number 1 & 2  will not gets executed and only the new migrations will be executed.

Comments (0)
Leave a Comment

loader Posting your comment...