首页 > 代码库 > MySQL样例数据导入

MySQL样例数据导入

从官网下载样例数据,参考压缩文件中的README.txt,整理所得

/******************* 样例数据导入 *******************//** 官网下载 http://dev.mysql.com/doc/index-other.html **//******** db1、menagerie ********//******* cmd登录mysql *******/mysql -P3307 -uroot -pCREATE DATABASE menagerie;USE menagerie;source E:/MySQL/ExampleDatabases/menagerie-db/cr_pet_tbl.sqlLOAD DATA LOCAL INFILE E:/MySQL/ExampleDatabases/menagerie-db/pet.txt INTO TABLE pet; # Load中只能用/,其他的\与/都可以使用,它们的区别是什么SOURCE E:/MySQL/ExampleDatabases/menagerie-db/ins_puff_rec.sqlSOURCE E:/MySQL/ExampleDatabases/menagerie-db/cr_event_tbl.sqlLOAD DATA LOCAL INFILE E:/MySQL/ExampleDatabases/menagerie-db/event.txt INTO TABLE EVENT;/******** command interpreter ********/#切换到.sql/.txt文件所在目录e:cd E:\MySQL\ExampleDatabases\menagerie-db#cd E:/MySQL/ExampleDatabases/menagerie-dbmysql -P3307 -uroot -p menagerie < cr_pet_tbl.sqlmysql -P3307 -uroot -p menagerie < load_pet_tbl.sqlmysqlimport -P3307 -uroot -p menagerie E:\MySQL\ExampleDatabases\menagerie-db\pet.txt #需指定路径,不然就 File E:\mysql\mysql-5.7.15\data\menagerie\xx.txt not found#mysqlimport -P3307 -uroot -p menagerie E:/MySQL/ExampleDatabases/menagerie-db/pet.txtmysql -P3307 -uroot -p menagerie < ins_puff_rec.sqlmysql -P3307 -uroot -p menagerie < cr_event_tbl.sqlmysqlimport -P3307 -uroot -p menagerie E:\MySQL\ExampleDatabases\menagerie-db\event.txt/******** db2、sakila ********//******* cmd登录mysql *******/mysql -P3307 -uroot -pCREATE DATABASE sakila;USE sakila;source E:/MySQL/ExampleDatabases/sakila-db/sakila-schema.sqlsource E:/MySQL/ExampleDatabases/sakila-db/sakila-data.sql/******** db3、world ********//******* cmd登录mysql *******/mysql -P3307 -uroot -pCREATE DATABASE world;USE world;source E:/MySQL/ExampleDatabases/world.sql/******** db4、world_x ********//******* cmd登录mysql *******/mysql -P3307 -uroot -pCREATE DATABASE world_x;USE world_x;source E:/MySQL/ExampleDatabases/world_x-db/world_x.sql

MySQL样例数据导入