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 (自己修改)
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<configuration>
<property>
<name>javax.jdo.option.ConnectionURL</name>
<value>jdbc:mysql://bigdata:3306/metastore?createDatabaseIfNotExist=true</value>
<description>JDBC connect string for a JDBC metastore</description>
</property>
<property>
<name>javax.jdo.option.ConnectionDriverName</name>
<value>com.mysql.jdbc.Driver</value>
<description>Driver class name for a JDBC metastore</description>
</property>
<property>
<name>javax.jdo.option.ConnectionUserName</name>
<value>root</value>
<description>username to use against metastore database</description>
</property>
<property>
<name>javax.jdo.option.ConnectionPassword</name>
<value>12345</value>
<description>password to use against metastore database</description>
</property>
<property>
<name>hive.cli.print.header</name>
<value>true</value>
<description>Whether to print the names of the columns in query output.</description>
</property>
<property>
<name>hive.cli.print.current.db</name>
<value>true</value>
<description>Whether to include the current database in the Hive prompt.</description>
</property>
</configuration>
2.导入的jar包错误或者版本太低
这里我使用的数据库是5.7但是没有对应的jar包,所以可以使用高一点的版本 比如8.0.16
然后把jar包拷贝到hive目录下的lib文件夹中
3.忘记启动hadoop,(初学者容易遗忘的原因),hive是基于hadoop的数据仓库,首先要启动hadoop之后才能使用hive连接数据库,切记切记/
之后重新启动即可