Hive中关于Mysql的安装与配置

Alex / 3-29 15:53 / Hive / Tag: hive

安装mysql 

 

 


  1.查询以前安装的mysql相关包
  rpm -qa | grep -i mysql


  2.如果已经安装过,暴力删除这个包
  rpm -e mysql-libs-5.1.66-2.el6_3.i686 --nodeps
  
  rpm -ivh MySQL-server-5.*
  rpm -ivh MySQL-client-5.*  


  3.安装好客户端后执行命令设置mysql
  /usr/bin/mysql_secure_installation
  

3.1 允许指定用户myuser从ip为192.168.1.6的主机连接到mysql服务器,并使用mypassword作为密码

      GRANT ALL PRIVILEGES ON *.* TO 'myuser'@'192.168.1.3'IDENTIFIED BY 'mypassword' WITH GRANT OPTION;

                 FLUSH PRIVILEGES


3.2 允许所有用户访问该数据库

             GRANT ALL PRIVILEGES ON hive.* TO 'root'@'%' IDENTIFIED BY '123' WITH GRANT OPTION;
                      FLUSH PRIVILEGES


  4.在hive当中创建两张表


  create table trade_detail (id bigint, account string, income double, expenses double, time string) row format delimited fields terminated by '\t';
  create table user_info (id bigint, account string, name  string, age int) row format delimited fields terminated by '\t';
  
  5.将mysq当中的数据直接导入到hive当中

  sqoop import --connect jdbc:mysql://192.168.8.95:3306/hadoop --username root --password 123 --table trade_detail --hive-import --hive-overwrite --hive-table student --fields-terminated-by '\t'


          sqoop import --connect jdbc:mysql://192.168.8.95:3306/hadoop --username root --password 123 --table user_info --hive-import --hive-overwrite --hive-table user_info --fields-terminated-by '\t'student

 


发表留言:

storm启动过程中出现'but found BlockMappingStart'和'but found Scalar'以及启动卡死问题个人解决方案 Phthon3.x字符串的方法及注释
返回顶部
Themes by lishiyu.cn