您的位置:首页 > 数据库 > MySQL

hive 配置mysql元数据库

2016-01-24 18:42 543 查看
在hive的配置文件hive-site.xml中
<?xmlversion="1.0"?>
<!--
LicensedtotheApacheSoftwareFoundation(ASF)underoneormore
contributorlicenseagreements.SeetheNOTICEfiledistributedwith
thisworkforadditionalinformationregardingcopyrightownership.
TheASFlicensesthisfiletoYouundertheApacheLicense,Version2.0
(the"License");youmaynotusethisfileexceptincompliancewith
theLicense.YoumayobtainacopyoftheLicenseat
http://www.apache.org/licenses/LICENSE-2.0
Unlessrequiredbyapplicablelaworagreedtoinwriting,software
distributedundertheLicenseisdistributedonan"ASIS"BASIS,
WITHOUTWARRANTIESORCONDITIONSOFANYKIND,eitherexpressorimplied.
SeetheLicenseforthespecificlanguagegoverningpermissionsand
limitationsundertheLicense.
-->
<?xml-stylesheettype="text/xsl"href="configuration.xsl"?>

<configuration>

<!--HiveConfigurationcaneitherbestoredinthisfileorinthehadoopconfigurationfiles-->
<!--thatareimpliedbyHadoopsetupvariables.-->
<!--AsidefromHadoopsetupvariables-thisfileisprovidedasaconveniencesothatHive-->
<!--usersdonothavetoedithadoopconfigurationfiles(thatmaybemanagedasacentralized-->
<!--resource).-->

<!--HiveExecutionParameters-->
<property>
<name>javax.jdo.option.ConnectionURL</name>
<value>jdbc:mysql://192.168.1.200:3306/hive?createDatabaseIfNotExist=true</value>
<description>JDBCconnectstringforaJDBCmetastore</description>
</property>
<property>
<name>javax.jdo.option.ConnectionDriverName</name>
<value>com.mysql.jdbc.Driver</value>
<description>DriverclassnameforaJDBCmetastore</description>
</property>

<property>
<name>javax.jdo.option.ConnectionUserName</name>
<value>root</value>
<description>usernametouseagainstmetastoredatabase</description>
</property>

<property>
<name>javax.jdo.option.ConnectionPassword</name>
<value>123456</value>
<description>passwordtouseagainstmetastoredatabase</description>
</property>
</configuration>


<name>javax.jdo.option.ConnectionUserName</name>为mysql的授权的用户名

<name>javax.jdo.option.ConnectionPassword</name>为mysql授权的密码然后输入hive命令

输入showdatabases;查看hive的数据库,默认为default

注意要把mysql-connector-java-xxx.jar驱动放到hive的lib目录下


                                            
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: