The reason why Hive failed to connect to the database (Nested Throwables)

Keywords: hive JDBC Database MySQL

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

In the process of learning hive, mysql is installed and the configuration of hive is completed.

bin/hive

Today, when I started hive, I made an error.

There are three main reasons:

1.hive configuration failed

Configure hive-site.xml under conf/. My host name is 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. Imported jar package error or version too low

The database I use here is 5.7, but there is no corresponding jar package, so I can use a higher version, such as 8.0.16.

Then copy the jar package to the lib folder in the hit directory

 

3. Forget to start hadoop. hive is a data warehouse based on hadoop./

Then restart it.

 

 


 

Posted by mm00 on Sun, 06 Oct 2019 14:23:36 -0700