MySQL Import Data using Laravel Seeds.
Import data from selected tables.
Setup the databases (From - To)
You must set the connection config for each database. There are some Env variables that we need to setup correctly.
#Origin database config info
DB_MIGRATE_FROM_CONNECTION=mysql-migrate-from
DB_MIGRATE_FROM_HOST=FromHostNAme
DB_MIGRATE_FROM_PORT=3306
DB_MIGRATE_FROM_DATABASE=fromDatabaseName
DB_MIGRATE_FROM_USERNAME=fromUserName
DB_MIGRATE_FROM_PASSWORD=FromPassword
#Destination database config info
DB_MIGRATE_TO_CONNECTION=mysql-migrate-from
DB_MIGRATE_TO_HOST=toHostName
DB_MIGRATE_TO_PORT=3306
DB_MIGRATE_TO_DATABASE=toDatabaseName
DB_MIGRATE_TO_USERNAME=toUserName
DB_MIGRATE_TO_PASSWORD=toPassword
#list of table that will be copied.
DB_MIGRATE_TABLES=mdl_quiz,mdl_quiz_grades
How to run it.
php artisan db:seed --class=DataMigrationSeeder
Last updated