hive 连接mysql

http://my.oschina.net/u/2510243/blog/552901   在这片hive的伪分布式已经安装过 

vim conf/hive-site.xml

<property>  

  <name>javax.jdo.option.ConnectionURL</name>  

  <value>jdbc:mysql://192.168.4.150:3306/hive?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>hive</value>  

  <description>username to use against metastore database</description>  

</property>  

  

<property>  

  <name>javax.jdo.option.ConnectionPassword</name>  

  <value>hive</value>  

  <description>password to use against metastore database</description>  

</property>  

mysql连接配置

创建hive用户密码hive,并赋予权限

mysql> CREATE USER 'hive' IDENTIFIED BY 'hive';

mysql> GRANT ALL PRIVILEGES ON *.* TO 'hive'@'%' WITH GRANT OPTION;

mysql> flush privileges;

vim /etc/mysql/my.cnf


将"# bind-address           = 127.0.0.1 “ 有就注释掉。

重启mysql服务: service mysql restart

添加jdbc包到hive/lib下面   mysql-connector-java-5.1.6-bin.jar

此时再启动hive就可以啦

之前的数据也看不到了 ,想要之前的文件,去掉配置重启就行

你可能感兴趣的:(hive 连接mysql)