此文是基于上一篇文章:Hive环境搭建及测试
一、root用户下:上传mysql安装包(mysql-5.5.32.tar.gz)到/install目录下,并解压安装;
二、hadoop用户下:上传mysql驱动包(mysql-connector-java-3.0.17-ga-bin.jar )到/software/hive-1.2.2/lib
修改Hive的配置文件:
vi /software/hive-1.2.2/conf/hive-site.xml
更改数据库连接方式:
394 <property> 395 <name>javax.jdo.option.ConnectionURL</name> 396 <!--<value>jdbc:derby:;databaseName=metastore_db;create=true</value>--> 397 <value>jdbc:mysql://192.168.154.134:3306/hive?createDatabaseIfNotExist=true&characterEncoding=utf8</value> 398 <description>JDBC connect string for a JDBC metastore</description> 399 </property>
更改驱动:
789 <property> 790 <name>javax.jdo.option.ConnectionDriverName</name> 791 <!-- <value>org.apache.derby.jdbc.EmbeddedDriver</value> --> 792 <value>com.mysql.jdbc.Driver</value> 793 <description>Driver class name for a JDBC metastore</description> 794 </property>
更改登陆名:
815 <property> 816 <name>javax.jdo.option.ConnectionUserName</name> 817 <!-- <value>APP</value> --> 818 <value>root</value> 819 <description>Username to use against metastore database</description> 820 </property>
更改登录密码:
379 <property> 380 <name>javax.jdo.option.ConnectionPassword</name> 381 <!-- <value>mine</value> --> 382 <value>123456</value> 383 <description>password to use against metastore database</description> 384 </property>
更改日志格式是二进制格式:
vi /etc/my.cnf
52 #binlog_format=mixed 53 binlog_format=row
三、测试安装是否成功:
root用户下:
cd /software/mysql-5.5.32/sbin
lsof -i:3306 //查看是否启动成功
cd /software/mysql-5.5.32/bin
./mysql -uroot -p123456 -e "drop database if exists hive;create database hive character set latin1" //必须为latin1;因为hive不支持utf-8 ./mysql -uroot -p123456 -e "show databases;"//显示是否成功创建数据库
原文地址:https://www.cnblogs.com/mmzs/p/8119461.html
时间: 2024-10-12 23:41:11