大数据练习中hive的使用问题
hive安装问题
前提记得启动hadoop
1.出现找不到HADOOP_HOME问题
解决方法
在/hive/bin下的hive-config.sh文件中配置HADOOP_HOME=“your hadoop”
2.启动hive出现Hive metastore database is not initialized
没有初始化元数据,可以通过
cd /usr/local/hive
./bin/schematool -dbType mysql -initSchema
3.初始化元数据失败
没有出现以下情况就是初始化失败( schemaTool failed )
这个原因跟你配置文件有关系(hive-site.xml)
启动mysql服务
systemctl start mysql (版本为Ubuntu20),部分启动MySQL命令时 system start mysql.service.
你使用的username没有在mysql中创建,还有一种情况是mysql驱动连接版本过低
如果你的mysql版本较低,就将value值改为com.mysql.jdbc.Driver.
另一种情况: 你需要在mysql中创建用户hive
先进入mysql中
先创建用户,前一个’hive’是用户名,**后一个’hive’是密码,它们需要跟’hive-site.xml’文件中username和password匹配上.**出现了"Query OK"表示创建成功.
给hive添加grant权限
最后刷新操作
再次进入hive中
输入./bin/schematool -dbType mysql -initSchema,到此hive启动成功!
其他问题解决方法
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘IDENTIFIED BY ‘root’ WITH GRANT OPTION’ at line 1.
ERROR 1064 (42000): You have an error in your SQL syntax with GRANT
解决mysql8报错:ERROR 1410 (42000): You are not allowed to create a user with GRANT