MySql和Hive错误汇总

hive、mysql安装报错

版本信息

Mysql 8.0.23 Hadoop 3.3 hive 3.1.2

1、命令:grant all . to hive@localhost identified by ‘hive’;

​ **错误:**RROR 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 ‘. to hive@localhost identified by ‘hive’’ at line 1

解决:

CREATE USER 'hive'@'localhost' IDENTIFIED BY 'hive';
GRANT ALL ON *.* TO 'hive'@'localhost';
FLUSH PRIVILEGES  #让权限生效。

查看mysql默认密码
root@dwh-VirtualBox:/etc/mysql# cat debian.cnf
用登录的用户密码登录
sudo mysql -uroot -p
安装后自己有一个默认的用户名以及密码。
sudo vi /etc/mysql/debian.cnf
user = debian-sys-maint
password = 8X4sxdS9HSR46AVQ

修改MySql密码
ALTER USER ‘root’@‘localhost’ IDENTIFIED WITH mysql_native_password BY '你的密码’;

2、启动hive报错:guava-19.0.jar版本不兼容

​ **错误:**Exception in thread “main” java.lang.NoSuchMethodError: com.google.common.base.Preconditions.checkArgument(ZLjava/lang/String;Ljava/lang/Object;

​ **解决:**hadoop和hive的guava-19.0.jar版本不兼容,将低版本的删除换成高版本的就行。

3、启动hive报错:缺失jar包

​ **错误:**Exception in thread “main” java.lang.RuntimeException: com.ctc.wstx.exc.WstxParsingException: Unexpected close tag ; expected .

​ **解决:**在Mysql官网下载mysql-connector-java-8.0.23.jar包,将包复制到hive下的lib中。

4、hive启动报错:配置文件格式错误

​ **错误:**com.ctc.wstx.exc.WstxParsingException: Unexpected close tag ; expected .

at [row,col,system-id]: [7,11,“file:/opt/hive/conf/hive-site.xml”]

​ **解决:**配置文件中成对出现的<>可能会有问题,仔细检查就能解决。

5、hive启动报错:未初始化数据库

​ **错误:**Required table missing : “VERSION” in Catalog “” Schema “”.

​ **解决:**执行命令

cd ~/hive/bin

./schematool -initSchema -dbType mysql

6.输出结果时 需要在hdfs中input 把文件file1 file2放到里面
./bin/hdfs dfs -mkdir input
./bin/hdfs dfs -put /opt/hadoop/input/file1.txt input
词频统计代码
hive> create table docs(line string);
hive> load data inpath ‘input’ overwrite into table docs;
hive>create table word_count as

select word, count(1) as count from
(select explode(split(line,’ '))as word from docs) w
group by word
order by word;

  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Hello World呀

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值