<configuration> <property> <name>javax.jdo.option.ConnectionURL</name> <value>jdbc:mysql://localhost:3306/hive</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>XXXX</value> <description>password to use against metastore database</description> </property> #如果不配置下面的部分会产生错误1. <property> <name>hive.exec.local.scratchdir</name> <value>/usr/local/hive/tmp/local</value> <description>Local scratch space for Hive jobs</description> </property> <property> <name>hive.downloaded.resources.dir</name> <value>/usr/local/hive/tmp/downloaded</value> <description>Temporary local directory for added resources in the remote file system.</description> </property> <property> <name>hive.querylog.location</name> <value>/usr/local/hive/tmp/location</value> <description>Location of Hive run time structured log file</description> </property> <property> <name>hive.server2.logging.operation.log.location</name> <value>/usr/local/hive/tmp/operation_logs</value> <description>Top level directory where operation logs are stored if logging functionality is enabled</description> </property> </configuration>
#创建数据库 mysql> create database hive; #赋予访问权限 mysql> grant all privileges on hive.* to root@localhost identified by '密码' with grant option; mysql> flush privileges; #将JDBC复制到Hive库目录用于java程序与mysql的连接 cp mysql-connector-java-5.1.35/mysql-connector-java-5.1.35-bin.jar /usr/local/apache-hive-1.1.0-bin/lib/