基于centos7的Hive安装

二:mysql的安装

        2.1:centos7默认安装的是mariadb,需要先卸载mariadb,先查看是否安装mariadb

rpm -qa | grep mariadb

        如果找到,则拷贝结果,使用下面命令删除,如删除mariadb-libs-5.5.35-3.el7.x86_64

rpm -e --nodeps mariadb-libs-5.5.35-3.el7.x86_64

        2.2   查找以前是否安装有mysql卸载,使用下面命令:

1:rpm -qa|grep -i mysql

如果已安装,则需要删除已安装的数据库,使用以下命令来删除数据库
删除命令:rpm -e --nodeps 包名

2.删除老版本mysql的开发头文件和库
命令:rm -fr /usr/lib/mysql
      rm -fr /usr/include/mysql
3.注意:卸载后/var/lib/mysql中的数据及/etc/my.cnf不会删除,如果确定没用后就手工删除
rm -f /etc/my.cnf
rm -fr /var/lib/mysql

        2.3 mysql安装包MySQL-server-5.6.24-1.el6.x86_64.rpm,

        MySQL-client-5.6.24- 1.el6.x86_64.rpm,mysql-connector-java-5.1.27.tar.gz

yum -y install autoconf
​
1:安装服务端    rpm -ivh MySQL-server-5.6.24-1.el6.x86_64.rpm
2:查看临时密码    cat /root/.mysql_secret
   密码为:Tn4l7JX18KV2vR8q

3:安装客户端    rpm -ivh MySQL-client-5.6.24-1.el6.x86_64.rpm
4:临时登录修改密码    mysql -uroot -pTn4l7JX18KV2vR8q
           

    ​mysql> SET PASSWORD=PASSWORD('123456');
    mysql>quit;
    
5: 再次进入mysql    mysql -uroot -p123456
    mysql>use mysql;
    mysql>select User, Host, Password from user;
    mysql>delete from user where Host='hadoop112';
    mysql>delete from user where Host='127.0.0.1';
    mysql>delete from user where Host='::1';
    mysql>select User, Host, Password from user;
    mysql>flush privileges;
    mysql>quit;

        2.4Hive 元数据配置到 MySql,

cp ./mysql-connector-java-5.1.27-bin.jar /opt/module/hive-1.2.1/lib/

        在hive的conf目录下创建hive-site.xml          vim hive-site.xml内容如下





 javax.jdo.option.ConnectionURL
 
jdbc:mysql://hadoop112:3306/metastore?createDatabaseIfNotExist=true
 JDBC connect string for a JDBC metastore


 javax.jdo.option.ConnectionDriverName
 com.mysql.jdbc.Driver
 Driver class name for a JDBC metastore

#mysql用户名

 javax.jdo.option.ConnectionUserName
 root
 username to use against metastore database

#mysql密码

 javax.jdo.option.ConnectionPassword
 123456
 password to use against metastore database

基于centos7的Hive安装_第1张图片

你可能感兴趣的:(大数据技术,hive,mysql)