IT練習ノート

IT関連で調べたこと(実際は嵌ったこと)を書いています。

MySQLのSample Databaseの設定

sample data

https://dev.mysql.com/doc/index-other.html

word_x-db

Download and unzip

shell> wget http://downloads.mysql.com/docs/world_x-db.zip
shell> unzip world_x-db.zip 

Read instruction

shell> less world_x-db/README.txt 

Connect to MySQL:

shell> mysql -u root -p

Load the file:

mysql> SOURCE /tmp/world_x-db/world_x.sql;

sakila-db

Download and unzip

shell> wget http://downloads.mysql.com/docs/sakila-db.zip
shell> unzip sakila-db.zip

Connect to MySQL:

shell> mysql -u root -p

Load the file:

mysql> SOURCE example-databases/sakila-db/sakila-schema.sql
mysql> SSOURCE example-databases/sakila-db/sakila-data.sql

Reference

https://dev.mysql.com/doc/sakila/en/sakila-installation.html

menagerie-db

download and unzip

shell> wget http://downloads.mysql.com/docs/menagerie-db.zip
shell> unzip menagerie-db.zip 

Connect to MySQL and make tables

shell> mysql -u root -p
mysql> SOURCE example-databases/menagerie-db/cr_pet_tbl.sql
mysql> SOURCE example-databases/menagerie-db/cr_event_tbl.sql

Disconnect mysql, cd and load data

shell> cd example-databases/menagerie-db
shell> mysql menagerie --local_infile=1 -u root -p < load_pet_tbl.sql
shell> mysqlimport --local menagerie event.txt

Reference

https://dev.mysql.com/doc/refman/5.6/en/load-data-local.htm://dev.mysql.com/doc/refman/5.6/en/load-data-local.html