添加HIve 的过程中,会要求配置 mysql, username, dbname 等连接信息。(取代了以往的在hive-site.xml 文件修改);
添加成功,可以认为Hive已经与mysql配置好了;
验证
运行mysql;
mysql> show databases;
会有曾经 装好mysql 时,创建的那些数据库 hue,hive等,我这里hive设置的数据库名称为metastore;
所以输入 use metastore
database changed
再输入 show tables
会输出 很多默认的表。。。。。
运行Hive-》执行一个创建语句
create table page_view(view_time String,country String,userid String,page_url String,refer_url String,ip String)row format delimited fields terminated by ',' lines terminated by '\n';
此时可能出现错误
MetaException(message:Required table missing : “DBS” in Catalog “” Schema “”. DataNucleus requires this table to perform its persistence operations
Either your MetaData is incorrect, or you need to enable “datanucleus.schema.autoCreateTables”)
解决方法: vim /etc/hive/conf/hive-site.xml
添加下面的属性。重新启动hive服务。
<property>
<name>datanucleus.schema.autoCreateAll</name>
<value>true</value>
</property>
show tables;
x显示表明就对了
load data local inpath '你的linux中的数据文件地址‘’ into table page_view;
再 select * from page_view;
ok
ok
ok