1 启动hive出现
ls: 无法访问’/usr/local/spark/lib/spark-assembly-.jar’: 没有那个文件或目录
解决:
修改//bin/hive文件,将加载原来的lib/spark-assembly-.jar替换成jars/*.jar,就不会出现这样的问题。
hive使用MySQL作为元数据
2 mysql安装的简单方法 安装过程中直接设置用户和密码
sudo apt-get update -
sudo apt-get install mysql-server
3 修改用户名:
update mysql.user set authentication_string=PASSWORD(‘123456’), plugin=‘mysql_native_password’ where user=‘root’;
flush privileges;
搞定
4 创建新的mysql用户
GRANT USAGE ON . TO ‘hive’@‘localhost’ IDENTIFIED BY ‘123456’ WITH GRANT OPTION;
grant all privileges on hive.* to ‘hive’@‘localhost’ identified by ‘123456’;
flush privileges;
5 验证hive配置
schematool -dbType mysql -initSchema 出现
Error: Specified key was too long; max key length is 3072 bytes (state=42000,code=1071)
解决:删除hive的元数据库,重新创建一个新的数据库,原因是数据库的编码错误,为UTF-8
查看mysql编码
show variables like '%char%';
drop hive;
create database hive character set latin1;
#创建表并设置编码
grant all on *.* to hive@localhost identified by '123456';
#将所有数据库的所有表的所有权限赋给hive用户,
后面的hive是配置hive-site.xml中配置的连接密码