1. 程式人生 > >培訓系列13--為後續和MySQL資料庫準備

培訓系列13--為後續和MySQL資料庫準備

We will be using the sakila database extensively inside the rest of the course and it would be great if you can follow the installation process below.

Importing the Sakila Database

 

// Change the File

Find and Replace all "InnoDB" with "MyISAM" in the schema file - different database engine - Full text - so don't have to upgrade

// MySQL用我的host03.xyy上安裝了mysql資料庫,所以在host03上做

mysql -u root -p

root

SOURCE /home/cloudera/Spark/sakila-db/sakila-schema.sql

SOURCE /home/cloudera/Spark/sakila-db/sakila-data.sql

SHOW FULL TABLES;

DROP VIEW actor_info;

DROP VIEW customer_list;

DROP VIEW film_list;

DROP VIEW nicer_but_slower_film_list;

DROP VIEW sales_by_film_category;

DROP VIEW sales_by_store;

DROP VIEW staff_list;

// Hive在host03機器上切換到hdfs使用者,然後執行hive,進入hive命令列

CREATE DATABASE sakila;

// Terminal在03機器上使用hdfs使用者進入,執行如下命令,否則找不到驅動程式。

sqoop import-all-tables --connect "jdbc:mysql://host03.xyy:3306/sakila" --username root --password root --hive-import --hive-database sakila