hive的hive-site.xml中加入
<property>
<name>javax.jdo.option.ConnectionURL</name>
<value>jdbc:mysql://10.20.109.213:3306/hive?createDatabaseIfNotExist=true</value>
</property>
<property>
<name>javax.jdo.option.ConnectionDriverName</name>
<value>com.mysql.jdbc.Driver</value>
</property>
<property>
<name>javax.jdo.option.ConnectionUserName</name>
<value>hive</value>
</property>
<property>
<name>javax.jdo.option.ConnectionPassword</name>
<value>hiveMysqlAb1234567890</value>
</property>
记得给mysql的hive用户相应的权限。
GRANT ALL PRIVILEGES ON hive.* TO [email protected] IDENTIFIED BY "hive";
GRANT ALL PRIVILEGES ON hive.* TO [email protected]‘%‘ IDENTIFIED BY "hive";
然后启动hive即可
如果遇到错误报jline相关,则拷贝hive/lib下的jline包到hadoop下的yarn路径下的lib中。
如果hive启动后有如下错误:
Specified key was too long; max key length is 767 bytes
那么就修改mysql中的my.cnf中的character_set_client和character_set_server,都设置成latin1,不要使用utf-8。