Menu

php artisan migrate:fresh --seed Can't Seed a Table Into MySQL
📰

php artisan migrate:fresh --seed Can't Seed a Table Into MySQL

DEV Community: laravel·Faizan·27 days ago
#ISGtjEDr
#devtolaravel#devto#dev#table#enter
Long article (1624 words) — no AI summary yet.
Reading 0:00
15s threshold

By the end of this you'll have every table filling cleanly from one command, and it takes about 15 minutes. If php artisan migrate:fresh --seed can't seed a table into MySQL in your project, the cause is almost always one of a few things in your seeder files, not in MySQL itself.

Short answer: migrate:fresh --seed only runs Database\Seeders\DatabaseSeeder . If your seeder isn't listed in its run() method, it never executes. If it does run and fails, the usual causes are seeding a child table before its parent (foreign key error), a model that points to the wrong table name, or missing timestamps columns.

Here's what you need before starting:

A Laravel project that uses the Database\Seeders namespace (the default for current projects)

A MySQL user that can drop and create tables in your database

A local or staging database.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.