Hive连接数据库失败的原因(NestedThrowables)

您所在的位置:网站首页 苹果显示器哪款比较好 Hive连接数据库失败的原因(NestedThrowables)

Hive连接数据库失败的原因(NestedThrowables)

2024-02-01 22:26| 来源: 网络整理| 查看: 265

NestedThrowables: java.sql.SQLException: Unable to open a test connection to the given database. JDBC url = jdbc:mysql://hadoop:3306/metastore?createDatabaseIfNotExist=true, username = root. Terminating connection pool (set lazyInit to true if you expect to start your database after your app). Original Exception: ------ java.sql.SQLException: null,  message from server: "Host 'bigdata-senior01' is not allowed to connect to this MySQL server

学习hive过程中,安装好了mysql并且完成了hive的配置

bin/hive

今天在启动hive的时候,报错。

主要有以下三个原因:

1.hive配置失败

在conf/下配置hive-site.xml   我的主机名是bigdata (自己修改)

javax.jdo.option.ConnectionURL jdbc:mysql://bigdata:3306/metastore?createDatabaseIfNotExist=true JDBC connect string for a JDBC metastore javax.jdo.option.ConnectionDriverName com.mysql.jdbc.Driver Driver class name for a JDBC metastore javax.jdo.option.ConnectionUserName root username to use against metastore database javax.jdo.option.ConnectionPassword 12345 password to use against metastore database hive.cli.print.header true Whether to print the names of the columns in query output. hive.cli.print.current.db true Whether to include the current database in the Hive prompt.

 

2.导入的jar包错误或者版本太低

这里我使用的数据库是5.7但是没有对应的jar包,所以可以使用高一点的版本  比如8.0.16

然后把jar包拷贝到hive目录下的lib文件夹中

 

3.忘记启动hadoop,(初学者容易遗忘的原因),hive是基于hadoop的数据仓库,首先要启动hadoop之后才能使用hive连接数据库,切记切记/

之后重新启动即可

 

 

 



【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3