本文主要講述在mac環(huán)境下安裝hive,目標讀者為大數(shù)據(jù)初學者或者有意進入大數(shù)據(jù)行業(yè)的研發(fā)人員。
閱讀本文前請先閱讀《mac環(huán)境下hadoop安裝》
需要先安裝mysql ,https://dev.mysql.com/downloads/file/?id=471631
mysql密碼重置
1) /usr/lcoal/mysql/bin/mysql.server stop
2)/usr/local/mysql/bin/mysqld_safe --skip-grant-tables
3)打開另一個終端:?/usr/local/mysql/bin/mysql -u root
UPDATE mysql.user SET authentication_string=PASSWORD('新密碼') WHERE User='root';
FLUSH PRIVILEGES;
\q
至此,密碼修改成功
進入/usr/local/Cellar/hive/2.1.1/bin
schematool -initSchema -dbType mysql? (一定要執(zhí)行,不然會出現(xiàn)錯誤)
如果出現(xiàn)錯誤,需要我們檢查目錄下是否已經(jīng)有,metastore_db這個目錄,如果有,那么就刪掉后重新執(zhí)行初始化命令。我的問題就是這個原因導致的。
進入mysql客戶端會看到生成了很多hive的表
接下來 執(zhí)行hive,看到hive命令行,表示成功
使用Squirrel SQL 連接hive
這里的坑比較多
首先下載squirrel SQL 自己百度
下載后配置driver:

出現(xiàn): xxx is notallowed to impersonate root
把下邊的root改為xxx
hadoop.proxyuser.root.groups
root
Allow the superuser oozie to impersonate any members of the group group1 and group2
hadoop.proxyuser.root.hosts
localhost
The superuser can connect only from host1 and host2 to impersonate a user
出現(xiàn):Name node is in safe mode
hadoop dfsadmin -safemode leave