第一步:将要迁移的数据库sql文件放置项目根目录下,例如要把sql文件3laoshi.sql倒入到新建的数据库3laoshi。
第二步:ls查看根目录下文件
DantedeMac-mini:sites tianjingang$ ls
3laoshi.sql admin admin.sql admin副本 blog
第三步 :执行mysql -uroot -p 3laoshi<3laoshi.sql;然后敲回车,输入数据库密码。
DantedeMac-mini:sites tianjingang$ mysql -uroot -p 3laoshi<3laoshi.sql
Enter password:
第四步:进入项目根目录,执行php artisan migrate命令。查看返回结果。
DantedeMac-mini:sites tianjingang$ cd admin
DantedeMac-mini:admin tianjingang$ php artisan migrate;
Migration table created successfully.
Migrating: 2014_10_12_100000_create_password_resets_table
Migrated: 2014_10_12_100000_create_password_resets_table
Migrating: 2017_02_21_152559_create_permissions_table
Migrated: 2017_02_21_152559_create_permissions_table
Migrating: 2017_04_01_173551_create_admins_table
Migrated: 2017_04_01_173551_create_admins_table
Migrating: 2017_04_01_180959_create_roles_table
Migrated: 2017_04_01_180959_create_roles_table
Migrating: 2017_04_03_135849_create_votes_table
Migrated: 2017_04_03_135849_create_votes_table
Migrating: 2017_04_03_135900_create_vote_questions_table
Migrated: 2017_04_03_135900_create_vote_questions_table
Migrating: 2017_04_03_135910_create_vote_results_table
Migrated: 2017_04_03_135910_create_vote_results_table
Migrating: 2017_04_05_120024_add_grades_to_lives_table
Migrated: 2017_04_05_120024_add_grades_to_lives_table
第五步:执行php artisan db:seed命令,进行数据库迁移
DantedeMac-mini:admin tianjingang$ php artisan db:seed;
Seeding: RoleTableSeeder
Role table seeded!