修改conf/hive-site.xml
<?xml version="1.0"?> <?xml-stylesheet type="text/xsl" href="configuration.xsl"?> <!-- Put site-specific property overrides in this file. --> <configuration> <property> <name>hive.metastore.local</name> <value>true</value> </property> <property> <name>javax.jdo.option.ConnectionURL</name> <value>jdbc:mysql://localhost:3306/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>hive</value> <description>username TOUSE against metastore database</description> </property> <property> <name>javax.jdo.option.ConnectionPassword</name> <value>admin</value> <description>password TOUSE against metastore database</description> </property> </configuration>
添加
export HADOOP_HOME=/usr/hadoop/hadoop export HADOOP_CONF_DIR=$HOME/config export HIVE_HOME=/usr/hadoop/hadoop/hive-0.7.0-bin export HIVE_CONF_DIR=$HOME/hive-config export PATH=$PATH:$HADOOP_HOME/bin:$HIVE_HOME/bin启动hive (启动hive前清先启动hadoop,mysql)