解決安裝配置hive時出錯Caused by: com.mysql.cj.core.exceptions.CJCommunicationsException: Communications link

當我按照教程配置好後出現打開hive出現了這樣的錯誤
Caused by: java.sql.SQLException: Unable to open a test connection to the given database. JDBC url = jdbc:mysql://hadoop-virtual-machine:3306/hive?CreateDatabaseIfNotExist=true, username = hive. Terminating connection pool (set lazyInit to true if you expect to start your database after your app). Original Exception: ------

com.mysql.cj.jdbc.exceptions.CommunicationsException: Communications link failure

Caused by: com.mysql.cj.jdbc.exceptions.CommunicationsException: Communications link failure

在網上也找到了很多帖子也嘗試了他們的方法,但是都不起作用

然後我看都有個帖子說是 重點JDBC url = jdbc:mysql://hadoop-virtual-machine:3306/hive?CreateDatabaseIfNotExist=true, username = hive.這裏出了問題 ,那我就查看了我的3306端口到底有沒有被監聽,

netstat -an|grep 3306

結果是3306前面是127.0.0.1,是127.0.0.1:3306這麼寫的,我嘗試着把hive-site.xml裏面的 jdbc:mysql://hadoop-virtual-machine:3306/hive?CreateDatabaseIfNotExist=true改成 jdbc:mysql://127.0.0.1:3306/hive?CreateDatabaseIfNotExist=true,然後我重新把hadoop進一遍,MySQL服務也重啓一遍,原諒我就是這麼神經,然後開啓hive

然後hive成功開啓

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章