> For the complete documentation index, see [llms.txt](https://dentalwhale.gitbook.io/documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://dentalwhale.gitbook.io/documentation/database-migrations/mysql-import-data-using-laravel-seeds..md).

# 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
```

{% hint style="info" %}
The list of  table names must be separated by commas, no spaces are allowed.
{% endhint %}

How to run it.

```
php artisan db:seed --class=DataMigrationSeeder
```
