1)安装mysql 命令:sudp apt-get install mysql-server,记得设置root用户密码;
2)设置mysql开机自启动,命令:sudo chkconfig mysql on。(三种办法,百度)
3)登录mysql 命令:mysql -u root -p 然后输入正确密码。
4)创建hive数据库,命令:create database hive。
5)赋予用户权限,
命令:grant all on *.* to 'root'@'hadoop01' identified by '0';
grant 权限 on 数据库名称.表名称 to 用户名@机器 idenfified by 密码;
用户名是机器的用户名 机器:ip区分(' %'表示所有的机器)
在mysql数据库user表里面,
update user set Host='%' where Host='localhost' and User='root',
然后将user下其他用户都给删除;
同时,设置mysql开机自启动,
update-rc.d mysql defaults,其它三种方式:
http://blog.csdn.net/chszs/article/details/49469655
6)解压hive安装包,在/etc/profile配置hive-home,即:
export HIVE_HOME=/home/hadoop/hive-1.2.1
export PATH=$PATH:$HIVE_HOME/bin
7)配置conf下 hive-env.sh
# Set HADOOP_HOME to point to a specific hadoop install directory
export HADOOP_HOME=/home/hadoop/hadoop-2.6.3
# Hive Configuration Directory can be controlled by:
export HIVE_CONF_DIR=/home/hadoop/hive-1.2.1/conf
8)配置hive-site.xml
<property>
<name>hive.metastore.warehouse.dir</name>
<value>/user/hive/warehouse</value>
</property>
<property>
<name>hive.metastore.local</name>
<value>true</value>
</property>
<property>
<name>javax.jdo.option.ConnectionURL</name>
<value>jdbc:mysql://localhost/hive? createDatabaseIfNotExist=true</value>
<description>JDBC connect string for a JDBC metastore</description>
</property>
<property>
<name>javax.jdo.option.ConnectionDriverName</name>
<value>com.mysql.jdbc.Driver</value>
<description>Driver class name for a JDBC metastore</description>
</property>
<property>
<name>javax.jdo.option.ConnectionUserName</name>
<value>root</value>
<description>username to use against metastore database</description>
</property>
<property>
<name>javax.jdo.option.ConnectionPassword</name>
<value>0</value>
<description>password to use against metastore database</description>
</property>
<property>
<name>hive.cli.print.header</name>
<value>true</value>
<description>Whether to print the names of the columns in query output.</description>
</property>
<property>
<name>hive.cli.print.current.db</name>
<value>true</value>
<description>Whether to include the current database in the Hive prompt.</description>
</property>
9)hadoop目录创建hive文件目录
$ $HADOOP_HOME/bin/hadoop fs -mkdir /tmp $ $HADOOP_HOME/bin/hadoop fs -mkdir /user/hive/warehouse $ $HADOOP_HOME/bin/hadoop fs -chmod g+w /tmp $ $HADOOP_HOME/bin/hadoop fs -chmod g+w /user/hive/warehouse10)启动hive,命令:bin/hive .